buildx
buildx copied to clipboard
`docker build` timeout issue in google cloud vm C3D
Description
docker build works on google cloud E2 images but not on C3D images.
Reproduce
- Create a default google cloud vm instance:
- Navigate to https://console.cloud.google.com/compute/instances
- On that page, click the 'Create Instance' button (it is a large blue button near the top of the page)
- On the new page scroll to "Machine configuration" and select the "C3D" radio button
- Click the 'Create' button (it is a large blue button near the bottom of the page)
- 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
- In the terminal window, install docker as per: https://docs.docker.com/engine/install/debian/
sudo apt-get updatesudo apt-get install ca-certificates curlsudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.ascsudo chmod a+r /etc/apt/keyrings/docker.asc- 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
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin- Add yourself to the docker group:
sudo usermod -aG docker $(whoami) && newgrp docker - Create a Dockerfile:
vi Dockerfile - 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"]
- 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
I also faced the same issue while building the image however I fixed it by using host network. e.g. docker build --network host -t my-app-image . .
Let me transfer this to the buildx issue tracker, as build is now handled through buildx (client-side) and buildkit (daemon side)