Docker删除镜像
参考:https://blog.csdn.net/lanshen110119/article/details/90201412
有标签
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}')
没有标签
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
删除全部
docker rmi $(docker images -q)
查看仓库镜像
curl http://192.168.13.247:5000/v2/_catalog
示例:查看仓库 kafka-product 镜像详细信息
curl http://192.168.13.247:5000/v2/kafka-product/tags/list
docker 添加日志限制
{
"log-driver": "json-file",
"log-opts": {
"max-size": "30m",
"max-file": "2"
}
}
docker 批量打包镜像
# 查找全部镜像
docker images | grep -v REPOSITORY | awk 'BEGIN{OFS=":";ORS=" "}{print $1,$2}'
# 查找xxx镜像
docker images | grep xxx | awk 'BEGIN{OFS=":";ORS=" "}{print $1,$2}'
# 批量存储镜像
docker save $(docker images | grep xxx | awk 'BEGIN{OFS=":";ORS=" "}{print $1,$2}') -o xxx.tar
# 批量存储rancher镜像
docker save $(docker images | grep rancher | awk 'BEGIN{OFS=":";ORS=" "}{print $1,$2}') -o rancher.tar
# 批量存储k8s依赖镜像
docker save $(docker images | grep -E 'k8s|flannel' | awk 'BEGIN{OFS=":";ORS=" "}{print $1,$2}') -o k8s-images.tar
docker-compose设置容器时间
参考:https://blog.csdn.net/ladymorgana/article/details/129949671
services:
environment:
TZ: "Asia/Shanghai"
docker镜像加速地址
"https://hub.uuuadc.top",
"https://docker.anyhub.us.kg",
"https://dockerhub.jobcher.com",
"https://dockerhub.icu",
"https://docker.ckyl.me",
"https://docker.awsl9527.cn"