How to Fix ERROR: Get https://registry-1.docker.io/v2/: n…

スポンサーリンク

ERROR: Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout in Docker

Error Overview

The error message “ERROR: Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout in Docker” indicates that there was a timeout during the TLS handshake when Docker attempted to connect to the Docker registry at https://registry-1.docker.io. This issue often arises due to network connectivity problems, slow internet connections, or misconfigured proxy settings.

Common Causes

Several factors can lead to this TLS handshake timeout error in Docker:

  1. Slow Internet Connection: A sluggish or unstable internet connection can hinder the TLS handshake process.
  2. Proxy Configuration: If Docker is operating behind a proxy, incorrect proxy settings can prevent it from establishing a connection to the Docker registry.
  3. Firewall Settings: Network firewalls may block Docker’s access to external URLs, leading to timeouts.
  4. DNS Issues: Problems with DNS resolution can prevent Docker from reaching the registry.
  5. Docker Daemon Issues: The Docker daemon may encounter problems that require a restart.

Solution Methods

Method 1: Restart the Docker Service

One of the simplest solutions is to restart the Docker service. Here’s how to do it:

  1. Open your terminal.
  2. Execute the following command to restart Docker:
    bash
    sudo systemctl restart docker
  3. After restarting, try pulling the Docker image again.

This method has resolved the issue for many users who faced the same TLS handshake timeout due to slow internet connections.

Method 2: Check Proxy Configuration

If you are operating behind a corporate proxy, ensure that your proxy settings are correctly configured. Follow these steps:

  1. Open the Docker service configuration file. This can usually be found in /etc/systemd/system/docker.service or similar paths depending on your installation.
  2. Add or modify the following lines under the [Service] section:
    ini
    [Service]
    Environment="HTTP_PROXY=http://pqr.corp.xxx.com:8080"
    Environment="HTTPS_PROXY=https://pqr.corp.xxx.com:8080"
    Environment="NO_PROXY=localhost,127.0.0.1"
  3. Save the file and restart the Docker service:
    bash
    sudo systemctl daemon-reload
    sudo systemctl restart docker
  4. Verify if the issue is resolved by attempting to pull an image.

Method 3: Change Docker Registry Mirror

In some cases, changing the Docker registry mirror can help bypass connectivity issues:

  1. Open your Docker daemon configuration file, usually located at /etc/docker/daemon.json.
  2. Add or modify the registry-mirrors section:
    “`json

コメント

タイトルとURLをコピーしました