#启动docker
systemctl start docker
# 导出镜像,从有镜像的环境上导出,或者在线加载镜像的环境导出镜像文件。
docker save mirrors.tencent.com/ptf/ptf_v1.0:latest| gzip > ptf.tar.gz
docker save chainmakerofficial/chainmaker-vm-docker-go:v2.2.4| gzip > chainmaker-vm-docker-go-224.tar.gz
# 导入镜像,把镜像本地文件导入到个人环境,进行解压加载
gunzip -c ptf.targz | docker load
gunzip -c chainmaker-vm-docker-go-224.tar.gz | docker load
# Docker镜像起别名:
docker tag oldTagName newTagName
docker tag chainmaker1.tencentcloudcr.com/chainmakerofficial/chainmaker-vm-engine:v3.0.0_qc chainmakerofficial/chainmaker-vm-engine:v3.0.0
# 删除none镜像:
docker image prune
# 删除指定镜像运行的容器:
docker rm $(docker stop $(docker ps -a -q -f ancestor=chainmakerofficial/chainmaker-vm-docker-go:v2.2.0))
docker rm $(docker stop $(docker ps -a -q -f ancestor=d4a562db22c8))
# 停止未运行的容器:
docker rm $(docker container ls -f 'status=exited' -q)
# 查找镜像的版本:
curl https://registry.hub.docker.com/v1/repositories/mysql/tags \
| tr -d '[\[\]" ]' | tr '}' '\n' \
| awk -F: -v image='mysql' '{if(NR!=NF && $3 != ""){printf("%s:%s\n",image,$3)}}'
拉取镜像:
docker pull mysql:8.0.2
批量停止docker
docker ps -a | grep -E "mysql|chainmaker-ca" | awk '{print $1}' | xargs docker stop | xargs docker rm
查看docker启动日志
Docker logs [id]
docker inspect 5e6804b46d38 获取容器/镜像的元数据。
启动所有容器:
docker start $(docker ps -a | awk '{ print $1 }' | tail -n +2)
进入docker容器
docker exec -it [id] bash