skip to Main Content

I have the following Dockerfile:

FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y cmake 

I’ve installed Docker Desktop on Mac via brew install --cask docker. When I run docker build ., it fails with:

 > [2/2] RUN apt-get update && apt-get install -y cmake:
0.100 Err:1 http://deb.debian.org/debian bullseye InRelease
0.100   Could not connect to localhost:8080 (127.0.0.1). - connect (111: Connection refused)
0.100 Err:2 http://deb.debian.org/debian-security bullseye-security InRelease
0.100   Unable to connect to localhost:8080:
0.100 Err:3 http://deb.debian.org/debian bullseye-updates InRelease
0.100   Unable to connect to localhost:8080:
0.101 Reading package lists...
0.105 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease  Could not connect to localhost:8080 (127.0.0.1). - connect (111: Connection refused)
0.105 W: Failed to fetch http://deb.debian.org/debian-security/dists/bullseye-security/InRelease  Unable to connect to localhost:8080:
0.105 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease  Unable to connect to localhost:8080:
0.105 W: Some index files failed to download. They have been ignored, or old ones used instead.

It appears as though it is trying to run through a proxy, but I’m not sure why. env | grep -i proxy is empty.

$ cat ~/.docker/daemon.json
{
 "builder": {
  "gc": {
   "defaultKeepStorage": "20GB",
   "enabled": true
  }
 },
 "experimental": false
}

A few other bits of info:

  • The same Dockerfile builds fine on Linux
  • cargo install or apt get install in a docker build produces a similar issue. Basically anything that hits the network inside a Dockerfile tries to go through localhost:8080
  • docker pull and other docker network operations outside of build do not have a problem, they don’t appear to be using a proxy
  • I’ve tried a factory reset and a full uninstall/reinstall of docker desktop

Why might builds be failing in a way that looks like it is trying to use a proxy?

2

Answers


  1. Chosen as BEST ANSWER

    docker buildx ls returned:

    $ docker buildx  ls
    NAME/NODE           DRIVER/ENDPOINT     STATUS    BUILDKIT   PLATFORMS
    default             docker
     _ default          _ default         running   v0.13.2    linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
    desktop-linux*      docker
     _ desktop-linux    _ desktop-linux   running   v0.13.2    linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
    

    After running docker context use default, builds no longer act as though they run through a proxy. I'm not sure where the desktop-linux builder came from, but it seems that the proxy config was somehow baked into that.


  2. You might have in "$HOME/Library/Group Containers/group.com.docker/settings.json"

    "overrideProxyHttp": "http://localhost:8080",
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search