1 docker下载
下载链接:https://download.docker.com/linux/static/stable/x86_64/
2 docker-compose下载
下载链接:https://github.com/docker/compose/releases/tag/v2.26.0
3 docker安装
1.使用mkdir -p /usr/local/docker/创建docker目录
2.使用工具Xftp将docker-26.0.0.tgz压缩包与docker-compose-linux-x86_64执行文件复制到docker目录下
3.解压docker-26.0.0.tgz压缩包并复制到/usr/bin/路径下
tar -zxvf docker-*.tgz
sudocp docker/* /usr/bin/
4.对docker-compose-linux-x86_64文件重命名并添加可执行权限
mv docker-compose-* docker-compose
chmod +x docker-compose
5.将docker-compose复制到/usr/bin并查看版本
sudocp docker-compose /usr/bin/
docker-compose version
6.创建docker.service文件
cd /etc/systemd/system/
touch docker.service
7.编辑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
# 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
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
8.添加可执行权限并加载
sudochmod +x /etc/systemd/system/docker.service
sudo systemctl daemon-reload
9.启动docker并查看状态
sudo systemctl start docker
sudo systemctl status docker
10.设置开机启动并查看版本
sudo systemctl enable docker.service
docker -v
版权归原作者 扮狮子的猫 所有, 如有侵权,请联系我们删除。