docker

73 阅读1分钟

1、安装docker出现错误

解决:

wget -O /etc/yum.repos.d/CentOS-Base.repo mirrors.aliyun.com/repo/Centos…

而后执行:

yum install -y docker-ce-19.03.14 docker-ce-cli-19.03.14

安装docker成功

2、docker拉取镜像并导出和加载

从Docker Hub上拉取Python 3.7的官方镜像

docker pull python:3.7

本地保存Python 3.7镜像

docker save python:3.7 -o python-3.7.tar

加载.tar文件并使用镜像

docker load -i python-3.7.tar

#创建镜像

docker build -t jenkins-demo:1.1 /server/docker

tag镜像

docker tag customcmpt:v1.0 172.11.1.143:38080/library/chery/customcmpt:v1.0

docker tag registry.aliyuncs.com/google_containers/coredns:v1.8.0 registry.aliyuncs.com/google_containers/coredns/coredns:v1.8.0

推送镜像

docker push 172.16.227.124:38080/library/chery/jenkins-demo:1.1

批量删除标签none的镜像

docker rmi $(docker images -q -f dangling=true)

强制删除所有名称为none的镜像

docker rmi -f $(docker images -f "dangling=true" -q)