Basic operations of Docker image

Introduction:   This article introduces the three most commonly used basic operations of Docker image: login, pull and push, and how to log in to a sub account. By understanding the basic operation of mirroring, you can more skillfully use the container mirroring service ACR.

For image download, domain name resolution and time synchronization, please click   Alibaba open source mirror station

1, Background information

Before using the container image service, you need to install Docker. For information on how to install Docker, see:

2, docker login

Take Alibaba cloud Hangzhou public network Registry as an example to illustrate how to log in to Docker.
1. Indicate the Registry domain name and enter your user name and login password. It will be displayed after successful login   Login Succeeded.

docker@default-online:~$ docker login
Login Succeeded

explain   The login password here is your Mirror warehouse management console   Instead of your alicloud login password.

2. Check the config.json file to confirm your login information.

docker@default-online:~$ cat ~/.docker/config.json
    "auths": {
        "": {
            "auth": "XXXXXXXXXXXXXXXXXXXXXX"

3, docker pull

Public image served as a container   For example, the command to download an image is as follows:

docker@default-online:~$ docker pull
0.8: Pulling from acs/agent
5a026b6c4964: Already exists
e4b621e8d9cb: Already exists
8bc2fd04bdd4: Pull complete
a977b0087b3e: Pull complete
8f6e00ea13c6: Pull complete
875dd8c9666f: Pull complete
9c07bcabc35d: Pull complete
Digest: sha256:cac848bd31bccf2a041bda7b57e3051341093abde6859df9ee9d332dfec6ddd9
Status: Downloaded newer image for


  • If you want to download the official image of Docker, please refer to the accelerator document in the relevant link below.
  • If you want to download the image under the public warehouse, you can download it without logging in to Registry.
  • The Registry you log in to and the Registry you operate the image must be consistent. For example, log in only   Push in case of   An unauthorized error message will appear on the client.

You can use the command below to view the downloaded image (note the warehouse coordinates and Tag).

docker@default-online:~$ docker images
REPOSITORY                                    TAG                 IMAGE ID            CREATED             SIZE   0.8                 b9ba5841bdb0        24 hours ago        42.18 MB

4, docker push

After the image is built or packaged in the local environment, it can be uploaded to the Registry.
The preparation for uploading is basically the same as that for downloading. You need to confirm that you have read-write permission or read-write authorization to this warehouse. Otherwise, you will see the error message below.

docker@default-online:~$ docker push
The push refers to a repository []
359f80267111: Layer already exists
7e5fa28d90b8: Layer already exists
b20d7f600f63: Layer already exists
4a159b4f8370: Layer already exists
7c3712ebe877: Layer already exists
d91d130a53aa: Layer already exists
fcad8ad5a40f: Layer already exists
unauthorized: authentication required

5, Login sub account

  1. Log in to the container image service console with a sub account and set the login password of the corresponding Registry.
  2. Log in with [sub account name] @ [enterprise alias] as the user name. You can set and view the enterprise alias of the master account in the RAM console. If there is no enterprise alias, the enterprise alias defaults to the UID of the main account.
    Suppose the sub account name is   subaccount, enterprise alias is   Misaka network, the login example is as follows:
docker@default-online:~$ docker login
Username: subaccount@misaka-network
Login Succeeded

  This article is transferred from: Basic operation of Docker image - alicloud developer community

Tags: Operation & Maintenance Docker Container

Posted on Fri, 03 Dec 2021 16:40:10 -0500 by Infinitive