docker / docker/buildx

`docker build` timeout issue in google cloud vm C3D

Open
#2,570 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status/triage
Dominant language
Go
Stars
4.5k
Forks
682
Avg merge
2d 14h
Merged PRs (30d)
29

Description

Description

docker build works on google cloud E2 images but not on C3D images.

Reproduce
  1. Create a default google cloud vm instance:
    1. Navigate to https://console.cloud.google.com/compute/instances
    2. On that page, click the 'Create Instance' button (it is a large blue button near the top of the page)
    3. On the new page scroll to "Machine configuration" and select the "C3D" radio button
    4. Click the 'Create' button (it is a large blue button near the bottom of the page)
  2. ssh into the new vm instance by clicking the 'ssh' button (it is black and borderless near the right of the page). This should create a terminal window
  3. In the terminal window, install docker as per: https://docs.docker.com/engine/install/debian/
  4. sudo apt-get update
  5. sudo apt-get install ca-certificates curl
  6. sudo install -m 0755 -d /etc/apt/keyrings
  7. sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
  8. sudo chmod a+r /etc/apt/keyrings/docker.asc
  9. This is a single multiline command:
echo \
 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
 $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  1. sudo apt-get update
  2. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  3. Add yourself to the docker group: sudo usermod -aG docker $(whoami) && newgrp docker
  4. Create a Dockerfile: vi Dockerfile
  5. Paste the following into Dockerfile
FROM python:3.12-slim

# Set working directory
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install ruff --index-url https://pypi.org/simple

# Make port 80 available to the world outside this container
EXPOSE 80

# Start a bash shell instead of running the application directly
CMD ["/bin/bash"]
  1. Run docker build -t my-app-image .
Expected behavior

docker build -t my-app-image . succeeds without timeout issues.

Instead, it times out with the following warnings:

 => ERROR [4/4] RUN pip install ruff --index-url https://pypi.org/simple                                104.5s
------                                                                                                         
 > [4/4] RUN pip install ruff --index-url https://pypi.org/simple:                                             
16.54 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/ruff/                                                                                              
32.16 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/ruff/
48.21 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/ruff/
65.25 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/ruff/
84.30 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/ruff/
99.35 ERROR: Could not find a version that satisfies the requirement ruff (from versions: none)
99.35 ERROR: No matching distribution found for ruff
------
Dockerfile:10
--------------------
   8 |     
   9 |     # Install any needed packages specified in requirements.txt
  10 | >>> RUN pip install ruff --index-url https://pypi.org/simple
  11 |     
  12 |     # Make port 80 available to the world outside this container
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install ruff --index-url https://pypi.org/simple" did not complete successfully: exit code: 1
docker version
$ docker version
Client: Docker Engine - Community                                                                              
 Version:           27.0.2                                                                                     
 API version:       1.46                                                                                       
 Go version:        go1.21.11                                                                                  
 Git commit:        912c1dd
 Built:             Wed Jun 26 18:47:36 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.0.2
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       e953d76
  Built:            Wed Jun 26 18:47:36 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.18
  GitCommit:        ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
 runc:
  Version:          1.7.18
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
docker info
$ docker info                                                         
Client: Docker Engine - Community                                                                              
 Version:    27.0.2                                                                                            
 Context:    default                                                                                           
 Debug Mode: false                                                                                             
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.15.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.28.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 27.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-21-cloud-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.63GiB
 Name: instance-20240630-195039
 ID: 2f4e1914-c7a2-47bc-b6b6-c10ff6c7ff2f
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
Additional Info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported docker build -t my-app-image . command on Debian 12 C3D and E2 Google Cloud VMs using the provided Dockerfile. Focus on the RUN pip install ruff --index-url https://pypi.org/simple step and compare network behavior and build output between machine types. Done means the C3D build completes without the repeated PyPI timeout and package-resolution failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, google-cloud, python
Domain
build-system, cloud, devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.