仓库(Repository):集中存放镜像的地方,分为公共仓库和私有仓库; 注册服务器(Registry):存放仓库的具体服务器,一个注册服务器可以有多个仓库; 官方公共仓库
Docker Hub
地址:[https://hub.docker.com/](https://hub.docker.com/)
;
Docker Hub 公共镜像市场
登录 - docker login
PS C:\Users\1314y> docker login -u 1314yjh
Password:
Login Succeeded
退出 - docker logout
PS C:\Users\1314y> docker logout
Removing login credentials for https://index.docker.io/v1/
PS C:\Users\1314y>
搭建本地私有仓库
需要注意: “insecure-registries”: [ “192.168.1.237:5000” ],
使用 registry 镜像创建私有仓库
我测试用的 window 10 操作系统。ip 为:192.168.1.237。
# 创建私有仓库
PS C:\Users\1314y> docker run -d -p 5000:5000 registry:2
Unable to find image 'registry:2' locally
2: Pulling from library/registry
6a428f9f83b0: Already exists
90cad49de35d: Pull complete
b215d0b40846: Pull complete
429305b6c15c: Pull complete
6f7e10a4e907: Pull complete
Digest: sha256:265d4a5ed8bf0df27d1107edb00b70e658ee9aa5acb3f37336c5a17db634481e
Status: Downloaded newer image for registry:2
7471723b188525f9a2f44df09749aa10fa6aaa6b16e0a3a40394025289a6a5fe
PS C:\Users\1314y> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7471723b1885 registry:2 "/entrypoint.sh /etc…" 9 seconds ago Up 8 seconds 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp xenodochial_brattain
# 准备镜像
PS C:\Users\1314y> docker tag ubuntu:latest 192.168.1.237:5000/test_ubuntu:1.0.0.1
PS C:\Users\1314y> docker images
192.168.1.237:5000/test_ubuntu 1.0.0.1 597ce1600cf4 11 days ago 72.8MB
ubuntu latest 597ce1600cf4 11 days ago 72.8MB
# 上传镜像
PS C:\Users\1314y> docker push 192.168.1.237:5000/test_ubuntu:1.0.0.1
# 下载
PS C:\Users\1314y> docker pull 192.168.1.237:5000/test_ubuntu:1.0.0.1