25.14、Dockerfile 打包、上传、分享

如何打包我们的镜像、上传我们的镜像和分享我们的镜像。

打包命令

docker build -t nginx-test:v1.0.0 .

-t:target,指定当前镜像版本

最后面的 ==.== 不能省略,表示当前路径,会自动找当前目录下的Dockerfile文件

提交到Docker 仓库 https://hub.docker.com/

添加上线版本信息,区别于内部开发版本,==注意用户名:monksoul==

docker tag nginx-test:v1.0.0 monksoul/nginx-test:v1.0.0

登录 docker hub平台

docker login
[root@localhost aspnetcore]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: monksoul
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
[root@localhost aspnetcore]#

上传

最后更新于

这有帮助吗?