• 第一章:docker环境安装


    1.更新数据源:

      拿到新的服务器,第一件事情,更新数据源,ubuntu系统可以通过执行如下指令:
    
    • 1
    
    echo 'deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    echo 'deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse' >> /etc/apt/sources.list && \
    
    apt-get update -y && \
    
    apt-get clean
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    debian系统如下:

    cat >/etc/apt/sources.list <<EOF
    deb http://mirrors.aliyun.com/debian stable main contrib non-free
    deb http://mirrors.aliyun.com/debian stable-proposed-updates main contrib non-free
    deb http://mirrors.aliyun.com/debian stable-updates main contrib non-free
    deb-src http://mirrors.aliyun.com/debian stable main contrib non-free
    deb-src http://mirrors.aliyun.com/debian stable-proposed-updates main contrib non-free
    deb-src http://mirrors.aliyun.com/debian stable-updates main contrib non-free
    EOF
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    更新:

    root@xyxypi:apt update
    root@xyxypi:~# apt upgrade
    
    • 1
    • 2

    注意:如果执行失败,查一下内核

    root@aml://# sudo dpkg  --print-architecture
    arm64
    
    • 1
    • 2

    如果返回时arm架构,是因为Ubuntu 18.04 使用apt-get 华为源支持 arm64 鲲鹏处理器,而阿里云163等等的,都不支持arm64,所以需要如下指令更新源:

    wget -O /etc/apt/sources.list https://repo.huaweicloud.com/repository/conf/Ubuntu-Ports-bionic.list
    apt-get update
    
    • 1
    • 2

    2.安装 Docker

    >> curl -fsSL get.docker.com -o get-docker.sh
    
    >> sh get-docker.sh --mirror AzureChinaCloud
    
    • 1
    • 2
    • 3

    如果是debian 系统,则参考:
    debian duocker安装

    执行成功之后docker即安装成功,此时要更新docker镜像源daemon.json 文件
    执行cd //  退到服务器主目录,执行 find -name "daemon.json" 找到自己的 daemon.json文件,一般在/etc/docker/daemon.json 目录下,然后执行vi /etc/docker/daemon.json 修改配置文件如下:(注意:insecure-registries 是后续要用到的远程镜像仓库地址)
    
    • 1
    • 2
    {
     "exec-opts": [
         "native.cgroupdriver=systemd"
     ],
     "log-driver": "json-file",
     "log-opts": {
         "max-size": "100m"
     },
     "registry-mirrors": [
         "http://hub-mirror.c.163.com",
         "https://dockerhub.azk8s.cn"
     ],
     "insecure-registries": [
         "*.*.*.*:7000" 
     ]
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    执行 docker version 即可看到如下docker 信息,表示安装正常
    
    • 1
     [root@k8s-master-67 //]# docker version
    Client: Docker Engine - Community
    Version:           24.0.5
    API version:       1.43
    Go version:        go1.20.6
    Git commit:        ced0996
    Built:             Fri Jul 21 20:39:02 2023
    OS/Arch:           linux/amd64
    Context:           default
    
    Server: Docker Engine - Community
    Engine:
    Version:          24.0.5
    API version:      1.43 (minimum version 1.12)
    Go version:       go1.20.6
    Git commit:       a61e2b4
    Built:            Fri Jul 21 20:38:05 2023
    OS/Arch:          linux/amd64
    Experimental:     false
    containerd:
    Version:          1.6.22
    GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
    runc:
    Version:          1.1.8
    GitCommit:        v1.1.8-0-g82f18fe
    docker-init:
    Version:          0.19.0
    GitCommit:        de40ad0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    3.后续

    按照上述及可完成docker安装,下一篇 安装 docker-compose,如果安装或者后续干货有问题,请微信扫码交流,或微信号联系:wx215602488 
    
    • 1

    在这里插入图片描述

  • 相关阅读:
    【git篇】git的使用
    使用redis-exporter对redis集群进行性能监控
    android编译
    iOS苹果签名共享签名是什么以及如何获取?
    如何做到在 5 分钟之内将应用大小减少 60% 的?
    修改Android Studio默认的gradle目录
    【LeetCode:2558. 从数量最多的堆取走礼物 | 大根堆】
    KingbaseES 数据库逻辑优化规则
    【AI视野·今日Sound 声学论文速览 第九期】Thu, 21 Sep 2023
    5G双域专网解决方案浅析
  • 原文地址:https://blog.csdn.net/baidu_31651237/article/details/132621613