Help Center/ SoftWare Repository for Container/ FAQs/ Troubleshooting/ Why Does the Login Command Fail to Be Executed?
Updated on 2025-07-16 GMT+08:00

Why Does the Login Command Fail to Be Executed?

Possible causes are as follows:

  1. The container engine is not properly installed, in which case the following error is reported:

    docker: command not found

    Solution: Reinstall the container engine. For details, see Installing a Container Engine.

    • To push images to SWR, the Docker version must be between 1.11.2 (included) and 24.0.9 (included).
    • If the container engine client is in a private network, bind an elastic IP address (EIP) to the client. This EIP will allow the client to download container engine installation packages from the website.
  1. The temporary login command has expired, or the regional project name, access key (AK), or login key in the command is incorrect, in which case the following error is reported:

    unauthorized: authentication required

    Solution: Log in to the SWR console. In the navigation pane, choose My Images. Click Upload Through Client in the upper right corner. In the displayed dialog box, click Generate Login Command.

    1. To obtain a temporary login command: On the Temporary Login Command tab page, click to copy the login command.
    2. To obtain a long-term login command: On the Long-Term Login Command tab page, import or enter the AK and SK to generate a login command. For details, see Obtaining a Long-Term Login Command.
  2. The image registry address in the login command is incorrect, in which case the following error is reported:

    Error logging in to v2 endpoint, trying next endpoint: Get https://{{endpoint}}/v2/: dial tcp: lookup {{endpoint}} on xxx.xxx.xxx.xxx:53 : no such host

    Solutions:

    1. Change the image registry address in the login command.

      The image registry address format is as follows: swr.regional project name.myhuaweicloud.com. For example, the image registry address for CN North-Beijing4 is swr.cn-north-4.myhuaweicloud.com.

    2. Generate a temporary login command. For detailed instructions, see 2.
  3. x509: certificate has expired or is not yet valid

    The preceding error is reported when the AK/SK in the login command with long-term validity is deleted. In this case, use a valid AK/SK to generate a login command.

  4. x509: certificate signed by unknown authority

    Possible Causes:

    The container engine client communicates with SWR through HTTPS. The client verifies the server certificate. If the server certificate is not issued by an authoritative organization, the following error message is displayed: "x509: certificate signed by unknown authority"

    Solutions:

    If you trust the server and skip certificate authentication, manually configure Docker startup parameters as follows:

    • CentOS:

      Modify the /etc/docker/daemon.json file. If the file does not exist, manually create it. Add the following content to the file:

      {
        "insecure-registries": ["{Image registry address}"]
      }
    • Ubuntu:

      Modify the /etc/default/docker file and add the following content to DOCKER_OPTS:

      DOCKER_OPTS="--insecure-registry {image registry address}"
    • EulerOS:

      Modify the /etc/sysconfig/docker file and add the following content to INSECURE_REGISTRY:

      INSECURE_REGISTRY='--insecure-registry {image registry  address}'

    The image registry address can be a domain name or an IP address.

    • Domain name: swr.[regional project name].myhuaweicloud.com. For example, the image registry address for CN North-Beijing4 is swr.cn-north-4.myhuaweicloud.com.
    • To obtain the image registry address in IP address format, ping the image registry address in domain name format.

    After the configuration, run the systemctl restart docker command to restart the container engine.

  5. denied: Authenticate Error

    The user does not have programmatic access. To grant programmatic access to this user, log in to IAM as an administrator. Click the name of this user to go to its details page. Click next to Access Type. Select both Programmatic access and Management console access. For more information about IAM, see IAM Service Overview.