- 1、安装docker
#yum remove docker \
docker-common \
container-selinux \
docker-selinux \
docker-engine \
docker-engine-selinux
#sudo yum install -y yum-utils device-mapper-persistent-data lvm2
#yum-config-manager --enable extras
#curl https://download.docker.com/linux/centos/docker-ce.repo > /etc/yum.repos.d/docker-ce.repo
#yum makecache fast
#yum install docker-ce
2、加速
#curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://50208f86.m.daocloud.io
3、设置IP段
#vim /etc/docker/daemon.json
{
"bip":"192.168.100.1/24"
}
4、修改docker存储路径
vim /etc/docker/daemon.json{
"graph": "/new-path/docker"
}
5、设置容器代理
#cat /usr/lib/systemd/system/docker.service
[Service]
Environment="HTTP_PROXY=http://10.53.xx.xx:1080/"
6、常用命令
启动服务:systemctl restart docker
docker信息: docker info
启动容器:docker run xxxxx
重启容器:docker restart 容器名或者ID
docker-compose:
docker-compose up -d
docker-compose down
原文地址:https://www.cnblogs.com/Qing-840/p/9263457.html
时间: 2024-10-13 15:31:31