Docker:登录私有仓库\退出私有仓库

一、登录仓库

        docker login : 登录到一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub

语法: docker login [OPTIONS] [SERVER]


docker login -u 用户名 -p 密码 仓库名称      # 登入私有仓库

[root@localhost ~]# docker login --username=用户名 registry.cn-hangzhou.aliyuncs.com

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

二、退出仓库

        docker logout : 退出一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub

语法: docker logout [SERVER]         # 退出默认官方仓库
[root@localhost ~]# docker logout 
Removing login credentials for https://index.docker.io/v1/
# 退出私有仓库

[root@localhost~]# docker logout registry.cn-hangzhou.aliyuncs.com
Removing login credentials for registry.cn-hangzhou.aliyuncs.com

你可能感兴趣的:(Docker,docker,容器,运维)