container icon indicating copy to clipboard operation
container copied to clipboard

[Request]: Docker Mirrors Support

Open qiqizjl opened this issue 1 year ago • 7 comments

Feature or enhancement request details

Due to the special network environment in China, we cannot directly access registry-1.docker.io. In DockerDestktop/orb, we can configure docker-mirrors. But the container does not support it.

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

qiqizjl avatar Jun 12 '25 08:06 qiqizjl

second +1

Cotch22 avatar Jun 12 '25 09:06 Cotch22

Can you please share some more information about this? We have a way to set the default registry in container via this command

container registry default set foo.bar

This will make it such that when you try to run a container

container run alpine uname

The image will be pulled from foo.bar/alpine:latest and not from docker.io

adityaramani avatar Jun 17 '25 05:06 adityaramani

Problems were encountered when running container run

container run hello-world
# or
container run docker.io/hello-world          

Error: unknown: "HTTPClientError.connectTimeout"

Previously, Docker was configured as follows.

Configure the Docker daemon

Either pass the --registry-mirror option when starting dockerd manually, or edit /etc/docker/daemon.json and add the registry-mirrors key and value, to make the change persistent.

{
  "registry-mirrors": ["https://<my-docker-mirror-host>"]
}

r9yn avatar Jun 17 '25 05:06 r9yn

The container registry default command looks different from Mirrors in Docker. In Docker, it supports multiple configurations. It will request in order. If the request fails, it will request the next one. When all mirrors fail, it will automatically request the default one. In addition, it is also different when downloading. It replaces docker.io, but the library still exists eg: Docker: docker pull alpine docker pull mirorrs/library/alpine

AppleContainer container pull alpine container pull mirrors/alpine

It seems that the library will be lost. So even if the default registry is configured, it will still have problems. I hope to align the mirrors in Docker

qiqizjl avatar Jun 17 '25 06:06 qiqizjl

@evil0th - are you able to run any container? I'm wondering if during container system start you were able to access artifacts which are hosted on ghcri (for guest initfs and kernel).

egernst avatar Jun 27 '25 16:06 egernst

@evil0th - are you able to run any container? I'm wondering if during container system start you were able to access artifacts which are hosted on ghcri (for guest initfs and kernel).

@egernst Running the container system start command can be executed correctly, but it cannot pull any image. The default docker environment also cannot work because it is affected by GFW. However, it can be done after configuring the docker mirror registry.

> container system start
Verifying apiserver is running...
Installing base container filesystem...
⠇ [1/2] Fetching image 0% (3 of 4 blobs, 871 KB/164.1 MB, 6 KB/s) [1m 26s]    

Verifying apiserver is running...
Installing base container filesystem...

> container images pull docker.io/python:alpine

Error: unknown: "HTTPClientError.connectTimeout"

r9yn avatar Jun 28 '25 03:06 r9yn

This one is similar to https://github.com/apple/container/issues/304.

In this case, you should be able to setup a new default registry, and directly use that mirror to support this use case. Today we don't plan to support 'docker mirrors'

There are a couple of areas where people have questions, feature requests for registries, so I'm going to transfer this to a GitHub discussion t get more input, and help with best practices, workarounds.

egernst avatar Jul 07 '25 16:07 egernst