1.安装docker 移除以前docker相关包 sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine 配置yum源 sudo yum install -y yum-utils sudo yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装docker
sudo yum install -y docker-ce docker-ce-cli containerd.io
启动
systemctl enable docker --now
配置加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://***.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

2.安装docker-compose curl -L https://get.daocloud.io/docker/compose/releases/download/v2.5.1/docker-compose-uname -s-uname -m > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose

3.安装网桥 docker network create --driver bridge 网桥名字 4.执行docker-compose 到docker-compose.yaml同一路径,执行docker-compose up -d

5.docker自启动

systemctl enable docker.service

6.docker-compose自启动脚本

cd /etc/rc.d/init.d/ && vim start-docker-compose.sh

#!/bin/bash
# chkconfig: 2345 85 15
# description: docker-compose init start

/usr/local/bin/docker-compose -f /data/mynginx/docker-compose.yml up -d
 
posted on 2022-05-27 11:14  白糖℃  阅读(399)  评论(0编辑  收藏  举报