濤。

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   濤。  阅读(417)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
< 2025年3月 >
23 24 25 26 27 28 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 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示
回到顶部