一、容器Container、仓库Repository、镜像Image的理解
镜像就像我们伟大的袁隆平的杂交水稻的种子;
容器就像我们伟大的袁隆平的稻田;
仓库就想我们伟大的袁隆平的粮仓;
二、仓库
NOTE: 仓库(Repository)存放了着各种各样的镜像(image)
NOTE: 注册服务器(Registry)是存储管理仓库的具体服务器,服务器上有多个仓库,仓库有多个镜像
-
dl.dockerpool.com/ubuntu是服务器/仓库结构
NOTE: Docker仓库使用和Github仓库有着神似
-
搜索镜像
docker search 镜像名 -
拉取镜像
docker pull 镜像名 -
推送镜像
docker push 镜像名 -
自动构建
NOTE: 这个就很有用了,可以用github实现自动部署升级项目版本
升级镜像内程序
git一键部署
三、私有仓库
-
运行私有仓库管理
-
打标签
docker tag
$ docker tag ubuntu:latest 127.0.0.1:5000/ubuntu:latest
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu latest ba5877dc9bec 6 weeks ago 192.7 MB
127.0.0.1:5000/ubuntu:latest latest ba5877dc9bec 6 weeks ago 192.7 MB
- 上传
docker push 私人服务器/镜像名
$ docker push 127.0.0.1:5000/ubuntu:latest
The push refers to repository [127.0.0.1:5000/ubuntu]
373a30c24545: Pushed
a9148f5200b0: Pushed
cdd3de0940ab: Pushed
fc56279bbb33: Pushed
b38367233d37: Pushed
2aebd096e0e2: Pushed
latest: digest: sha256:fe4277621f10b5026266932ddf760f5a756d2facd505a94d2da12f4f52f71f5a size: 1568
- 下载
docker pull 私人服务器/镜像名
$ docker image rm 127.0.0.1:5000/ubuntu:latest
$ docker pull 127.0.0.1:5000/ubuntu:latest
Pulling repository 127.0.0.1:5000/ubuntu:latest
ba5877dc9bec: Download complete
511136ea3c5a: Download complete
9bad880da3d2: Download complete
25f11f5fb0cb: Download complete
ebc34468f71d: Download complete
2318d26665ef: Download complete

升级镜像内程序
git一键部署









网友评论