发布镜像到 DockerHub及阿里云镜像仓库

it2024-11-21  0

目录

DockerHub

阿里云镜像仓库


DockerHub

1.网址:https://hub.docker.com/  注册自己的账号 2.确定这个账号可以登录 3.在我们的服务器上提交自己的镜像

通过命令行登录

[root@web www]# docker login --help Usage: docker login [OPTIONS] [SERVER] Log in to a Docker registry. If no server is specified, the default is defined by the daemon. Options: -p, --password string Password --password-stdin Take the password from stdin -u, --username string Username

登录指令:docker login -u 用户 

[root@web www]# docker login -u bertram521 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

4.登录完毕后就可以提交镜像了,就一步 docker push 

# push 自己的镜像到服务器上 [root@web www]# docker push nginx:1.0 The push refers to repository [docker.io/library/nginx] 832b0112f0e1: Preparing b66c1435fca1: Preparing 3750f7c949a2: Preparing b61ba12b8148: Preparing ddb5f4a9d9da: Preparing 291f6e44771a: Waiting denied: requested access to the resource is denied # 拒绝 # push镜像的存在的问题 [root@web www]# docker push bertram521/nginx:1.0 The push refers to repository [docker.io/bertram521/nginx] An image does not exist locally with the tag: bertram521/nginx # 解决 增加一个Tag [root@web www]# docker tag 5335d084deca nginx_1.0/nginx:2.0 # docker push 上去即可!自己发布的镜像尽量加版本号 [root@web www]# docker push nginx_1.0/nginx:1.0

阿里云镜像仓库

1.登录阿里云 2.找到容器镜像服务

3.创建镜像空间

4.创建命名空间(隔离防止镜像冲突)

5.浏览阿里云基本信息

 具体参考阿里云官网文档!

最新回复(0)