1.docker配置添加信任register
centos:
echo “OPTIONS=’–insecure-registry nexuscimgmt2.sgp.com:5000′” >> /etc/sysconfig/docker
ubuntu:
cat > /etc/docker/daemon.json << EOF
{
“insecure-registries”: [“nexuscimgmt2.sgp.com:5000″,”nexuscimgmt2.sgp.com:8087”]
}
EOF
systemctl restart docker
systemctl daemon-reload
2.常用命令
docker volume rm $(docker volume ls -qf dangling=true) || true
docker rm $(docker ps -q -f status=exited) || true
docker rmi $(docker images -f dangling=true -q) || true
docker rmi $(docker images | sed 1,2d | awk ‘{print $3}’) || true
docker image rmi $(docker images | sed 1d | awk ‘{print $3}’)
3.多阶段构建Docker image参考示例(可有效减小构建好的image大小/docker image瘦身)
https://github.com/GoogleContainerTools/kaniko/blob/main/deploy/Dockerfile
评论前必须登录!
注册