12、Docker-上传Docker仓库

2019-09-14  本文已影响0人  唯老

一、前期准备工作

1、注册申请Docker hub账号

首先在https://hub.docker.com/官网申请一个docker hub 帐号
按着提示操作就行

2、创建仓库

点击Repositories

image

创建镜像仓库

image

填写仓库信息

image

创建成功获取上传地址

image

二、创建镜像

1、创建dockerfile

FROM ubuntu
CMD echo "hello"

2、构建镜像

docker  build -t zw/sx-ubuntu ./

3、查看镜像

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
zw/sx-ubuntu        latest              6b6e47f29036        7 seconds ago       64.2MB

4、给镜像打标签

 # docker tag 本地镜像[:TAG] 远程仓库镜像名[:TAG]
 # zhangwei/sx 我们创建私有仓库的一个名字直接复制过来
 docker tag zw/sx zhangwei725/sx

三、上传

1、登录

➜  dockerfile docker login
Username: zhangwei725
Password:
Login Succeeded

2、上传

docker push zhangwei725/sx
The push refers to repository [docker.io/zhangwei725/sx]
122be11ab4a2: Mounted from library/ubuntu
7beb13bce073: Mounted from library/ubuntu
f7eae43028b3: Mounted from library/ubuntu
6cebf3abed5f: Mounted from library/ubuntu
latest: digest: sha256:c25e638c0c9984c0946aa6233c3a1e2ff3b2b1365fff649b75cd06df12dd4123 size: 1152
上一篇 下一篇

猜你喜欢

热点阅读