本文地址:https://www.cnblogs.com/veinyin/p/10452224.html 

以下均为命令行下操作

登录登出

docker login  //  登录
docker logout // 登出

操作

docker search imageName  // 搜索镜像,可加查询关键字

docker pull imageName  // 拉取镜像

docker push username/image:tag  // 推送镜像

私有仓库

创建私有仓库,指定路径为 ~/Documents/work/registry

docker run -d -p 5000:5000 -v ~/Documents/work/registry:/var/lib/registry registry

上传到本地仓库

docker tag ubuntu:latest 127.0.0.1:5000/ubuntu:latest  // 必须本机IP或内网开头,作为仓库地址
docker push 127.0.0.1:5000/ubuntu:latest

tag 必须为本机 IP 或内网 IP 开头,否则会报错

上传到远端仓库

docker tag ubuntu:latest yinyuhui/ubuntu:latest
docker push yinyuhui/ubuntu:latest

tag 必须以用户名开头,否则会报错

查看仓库中的镜像

curl 127.0.0.1:5000/v2/_catalog

下载镜像 

docker pull 127.0.0.1:5000/ubuntu

END~~~≥ω≤ 

05-11 16:25
查看更多