执行命令
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum install docker-ce
systemctl start docker
systemctl enable docker
配置镜像加速器
参考列表:
https://xxxxx.mirror.aliyuncs.com
替换下方任一地址
https://docker.m.daocloud.io
https://mirror.baidubce.com
https://docker.nju.edu.cn
针对Docker客户端版本大于 1.10.0 的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
参考命令
进入容器
docker exec -it 容器id /bin/bash
容器日志
docker logs -f --tail=100 容器id
删除容器
docker rm 容器id
docker性能测试
https://dominoweb.draco.res.ibm.com/reports/rc25482.pdf
docker集群
初始化
docker swarm init
Swarm initialized: current node (jdly5e6xysv42x1ck4o8fk2mw) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-024208pjl9lwvmkxuip0zfpj8esbdkvir3atesytcqclccdkwh-cq5h0qk8fy8okovbq97qrdstx 192.168.1.100:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
加入节点
docker swarm join --token SWMTKN-1-024208pjl9lwvmkxuip0zfpj8esbdkvir3atesytcqclccdkwh-cq5h0qk8fy8okovbq97qrdstx 192.168.1.100:2377
参考
https://yeasy.gitbook.io/docker_practice/swarm_mode/create
https://www.runoob.com/docker/docker-swarm.html
Docker Compose:https://www.runoob.com/docker/docker-compose.html