濤。

t.

虚拟机 CentOs 7 离线安装 Docker

虚拟机 CentOs 7 离线安装 Docker

Docker 下载网址:

https://download.docker.com/linux/static/stable/x86_64/

1.在usr下的local中新建名称为docker的文件夹
cd /usr/local/

mkdir docker

2.进入/usr/local/docker目录,上传docker压缩文件
cd docker

解压执行:

tar -zxvf docker-18.06.3-ce.tgz

 

3.将解压出来的docker文件复制到/usr/bin/目录下
cp docker/* /usr/bin/

4.进入/etc/systemd/system/目录,并创建docker.service文件
cd /etc/systemd/system/

touch docker.service

5.打开docker.service文件,
vim docker.service

将以下内容复制进去

注意:ip地址改为自己的(ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=192.168.94.110)

 [Unit]
 Description=Docker Application Container Engine
 Documentation=https://docs.docker.com
 After=network-online.target firewalld.service
 Wants=network-online.target
 ​
 [Service]
 Type=notify
 # the default is not to use systemd for cgroups because the delegate issues still
 # exists and systemd currently does not support the cgroup feature set required
 # for containers run by docker
 ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=192.168.94.110
 ExecReload=/bin/kill -s HUP $MAINPID
 # Having non-zero Limit*s causes performance problems due to accounting overhead
 # in the kernel. We recommend using cgroups to do container-local accounting.
 LimitNOFILE=infinity
 LimitNPROC=infinity
 LimitCORE=infinity
 # Uncomment TasksMax if your systemd version supports it.
 # Only systemd 226 and above support this version.
 #TasksMax=infinity
 TimeoutStartSec=0
 # 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
 # restart the docker process if it exits prematurely
 Restart=on-failure
 StartLimitBurst=3
 StartLimitInterval=60s
 ​
 [Install]
 WantedBy=multi-user.target

6.给docker.service文件添加执行权限
chmod 777 /etc/systemd/system/docker.service

7.重启使配置生效
systemctl daemon-reload

8.启动docker
systemctl start docker

9.查看docker状态
systemctl status docker

出现这个页面就表示成功了

10.打开docker配置文件,配置国内镜像加速器
vim /etc/docker/daemon.json

配置如下:

{
   "registry-mirrors": ["https://ky3rtfiy.mirror.aliyuncs.com"]
 }

重启使配置生效

systemctl daemon-reload
11.重启docker
systemctl restart docker

 

 

posted on 2021-12-28 20:28  濤。  阅读(395)  评论(0编辑  收藏  举报

导航