一、安装docker和docker-compose
step 1: 下载二进制docker安装包
下载地址:https://download.docker.com/linux/static/stable/x86_64/
选择相应版本下载
Step 2: 上传二进制安装包到服务器
Step 3: 解压安装文件,并复制文件到/usr/bin
tar -zxvf docker-24.0.9.tgz
cp -p docker/* /usr/bin
Step 4: 将docker注册系统服务
vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker.socket
[Service]
Type=notify
EnvironmentFile=-/run/flannel/docker
WorkingDirectory=/usr/local/bin
ExecStart=/usr/bin/dockerd \
-H tcp://0.0.0.0:4243 \
-H unix:///var/run/docker.sock \
--selinux-enabled=false \
--log-opt max-size=1g
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=on-failure
[Install]
WantedBy=multi-user.target
Step 5:启动守护进程
systemctl daemon-reload
systemctl start docker
step 6: 设置docker开机自启
systemctl enable docker
step 7: 查看docker版本信息
docker version
step 8: 下载docker-compose,下载地址https://github.com/docker/compose/releases,将下载文件上传到服务器。
step 9: 将文件转移至/usr/local/bin/
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-