docker容器出现status: restarting
而不是status: up
的话说明是镜像有问题
可以通过
docker logs <容器id>
来查看错误日志- 排查修改源码之后可以通过
docker-compose up -d --force-recreate --build
来重新打包镜像
centos安装docker全家桶
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
之前装过要重装需要卸载旧版本
sudo yum remove docker /
docker-client /
docker-client-latest /
docker-common /
docker-latest /
docker-latest-logrotate /
docker-logrotate /
docker-engine
换源
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://l7c7zlff.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
连接容器
docker exec -it <container name> /bin/sh
原创文章,作者:kirin,如若转载,请注明出处:https://blog.ytso.com/273877.html