1 安装docker
1 方式一(rpm):
下载需要安装版本的docker的安装包,会存在相应的依赖包,需要确定,
下载地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
2 下载二进制文件安装(tgz)
下载地址:https://download.docker.com/linux/static/stable/x86_64/
2.1 解压文件
tar -xvf docker-19.03.5-ce.tgz
2.2 将解压出来的docker文件内容移动到/usr/bin/ 目录下
cp docker/* /usr/bin/
2.3 将docker注册为service
vim /etc/systemd/system/docker.service
[Unit]
Description=Docker Application ContainerEngine
Documentation=https://docs.docker.com
After=network-online.targetfirewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd forcgroups because the delegate issues still
# exists and systemd currently does notsupport 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 causesperformance problems due to accounting overhead
# in the kernel. We recommend using cgroupsto do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemdversion supports it.
# Only systemd 226 and above support thisversion.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does notreset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not allprocesses in the cgroup
KillMode=process
# restart the docker process if it exitsprematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
2.4 启动
添加文件权限并启动
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
docker –version
2 安装docker-compose
下载需要版本的docker-compose
下载地址:https://github.com/docker/compose/releases
将下载的版本移动到/usr/local/bin/目录下
添加可执行权限
chmod +x /usr/local/bin/docker-compose