Docker之安装部署

本次部署使用openEuler操作系统:

方式一:使用yum安装(openEuler源中有自带的docker18.09.0版本)

[root@node1 ~]# yum install docker -y
[root@node1 ~]# docker version
Client:
 Version:           18.09.0
 EulerVersion:      18.09.0.332
 API version:       1.39
 Go version:        go1.17.3
 Git commit:        9942888
 Built:             Wed Dec 27 10:05:53 2023
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.0
  EulerVersion:     18.09.0.332
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.17.3
  Git commit:       9942888
  Built:            Wed Dec 27 10:05:15 2023
  OS/Arch:          linux/amd64
  Experimental:     false

方式二:通用二进制方式安装docker(适用于所有版本)

二进制包下载地址: https://download.docker.com/linux/static/stable/x86_64/

[root@node2 ~]# wget -c  https://download.docker.com/linux/static/stable/x86_64/docker-25.0.3.tgz
[root@node2 ~]# tar xzf docker-25.0.3.tgz -C /usr/local/  #解压
[root@node2 ~]# vim /usr/lib/systemd/system/docker.service  #配置服务脚本
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash

ExecStart=/usr/bin/dockerd $OPTIONS \
                           $DOCKER_STORAGE_OPTIONS \
                           $DOCKER_NETWORK_OPTIONS \
                           $INSECURE_REGISTRY

ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process

[Install]
WantedBy=multi-user.target

[root@node2 ~]# cp /usr/local/docker/* /usr/bin/ 
[root@node2 ~]# systemctl start docker.service
[root@node2 ~]# docker version
Client:
 Version:           25.0.3
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        4debf41
 Built:             Fri Feb 23 02:37:27 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.3
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       f417435
  Built:            Fri Feb 23 02:38:33 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.13
  GitCommit:        7c3aca7a610df76212171d200ca3811ff6096eb8
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

方式三:yum仓库方式安装

[root@node2 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 #安装依赖
[root@node2 ~]# wget  -O   /etc/yum.repos.d/docker-ce.repo

https://mirrors.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo
[root@node2 ~]# sed  -i  's+download.docker.com+mirrors.huaweicloud.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo   #替换仓库源
[root@node2 ~]# sed   -i   's/$releasever/8Server/g'    /etc/yum.repos.d/docker-ce.repo  
#CentOS7只要把8Server换成7Server
[root@node2 ~]# yum install docker-ce -y
[root@node2 ~]# docker version
Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:02:19 2022
 OS/Arch:           linux/amd64
 Context:           default

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值