Docker 安装教程
常用命令
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl start docker.service
sudo service docker restart
sudo systemctl stop docker
sudo docker ps 查看已经运行的容器
sudo docker images 查看已经下载的镜像
sudo docker rm 容器ID 删除容器
sudo docker rmi 镜像ID 删除镜像
sudo docker stop 容器ID 停止容器
sudo mv 源 目标
yum被packagekit占用解决方案
1.....删除/var/run/yum.pid 就可以正常使用了,即
rm -rf /var/run/yum.pid
2.....packagekit 占用yum 杀掉
sudo systemctl stop packagekit
sudo systemctl disable packagekit
sudo yum remove PackageKit
方便命令行复制粘贴
sudo yum install gpm*
sudo service gpm start
sudo yum remove docker \
docker-common \
docker-selinux \
docker-engine
或者
docker-ce
docker-cli
containerd.io
step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Step 2: 添加软件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Step 3: 安装docker-ce
sudo yum install docker-ce
Step 4:测试是否安装成功
docker --version
启动 服务 hello world
sudo systemctl start docker
docker run hello-world
如果无法访问,是service没打开
sudo service docker start
Step 5:更改国内镜像
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://c30815r6.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
虚拟机请选择 桥接模式 直接连接物理网络 复制物理网络连接状态
step 6:下载 doker-compose
1.直接下载 并修改权限
curl -L https://github.com/docker/compose/releases/download/1.8.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
2.通过pip下载
yum -y install epel-release
yum -y install python-pip
pip install --upgrade pip
pip install -i http://mirrors.aliyun.com/pypi/simple/ docker-compose