创建dockerhub仓库
-
点击“Repositories”->“Create Repository”
-
输入仓库名称(我的叫test)
-
点击页面底部的“Create”按钮创建存储库。
将本地容器保存为镜像,上传镜像
- 在docker登录dockerhub账户
docker login
- 查看容器
docker ps
- 将容器保存为镜像(注意:“magicbox123/test”为你的“账号名/仓库名”,必须正确或者保存为image后修改修改tag)
root@ubuntu:/home/bios# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
235ace0ea018 ubuntu "/bin/bash" 2 hours ago Up 2 hours cloud_test
root@ubuntu:/home/bios# docker commit 235ace magicbox123/test:cloud_test
- 上传镜像到仓库(注意:“magicbox123/test”为你的“账号名/仓库名”,必须正确)
root@ubuntu:/home/bios# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
magicbox123/test cloud_test 2d4d138ab05c 10 seconds ago 100MB
ubuntu latest 4dd97cefde62 11 days ago 72.9MB
training/webapp latest 6fae60ef3446 5 years ago 349MB
root@ubuntu:/home/bios# docker push magicbox123/test:cloud_test
The push refers to repository [docker.io/magicbox123/test]
e8dc33e92ef9: Pushed
c20d459170d8: Pushed
db978cae6a05: Pushed
aeb3f02e9374: Pushed
cloud_test: digest: sha256:713a3227d17158e1c4db3a4214ab488f2a2d595d22f4c317b05b25a1675ecc25 size: 1155
root@ubuntu:/home/bios#