darwin-containers / rund

OCI Container Runtime for Darwin
Apache License 2.0
473 stars 14 forks source link

docker build stuck forever on context creation #26

Closed awdAvenger closed 1 year ago

awdAvenger commented 1 year ago

I'm having issues running a simple 'docker build .' command of a very simple Dockerfile:

FROM ghcr.io/macoscontainers/macos-jail/ventura:latest

RUN mkdir -p /test

Installation has been performed with homebrew as per the readme in the homebrew-repository and I can run containers with 'docker run' like the example in the Readme.

Here is the output when trying 'docker build .':

$ docker build  --progress=plain .
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile:
#1 transferring dockerfile: 212B done
#1 DONE 0.1s

And there it's stuck, I tried to wait for 10 mins and if I press CTRL-C after that I get:

^CERROR: failed to solve: Canceled: context canceled

SIP has been disabled and I'm running MacOS Sonoma:

$ sw_vers
ProductName:            macOS
ProductVersion:         14.1.1
BuildVersion:           23B81

Here's the docker info while the build is stuck:

$ docker info
Client: Docker Engine - Community
 Version:    24.0.7
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /Users/user/.docker/cli-plugins/docker-buildx

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: library-import
 Storage Driver: vfs
 Logging Driver: json-file
 Plugins:
  Volume: 
  Network: host null
  Log: json-file local
 Swarm: inactive
 Kernel Version: 23.1.0
 Operating System: arm64 (error determining if containerized)
 OSType: darwin
 Architecture: arm64
 CPUs: 10
 Total Memory: 0B
 Name: Mac-mini.local
 ID: 7082e257-5c11-4ded-bedf-407bb1c5126b
 Docker Root Dir: /private/d/
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
awdAvenger commented 1 year ago

I got it to get further.

I was trying this from SSH and didn't notice a popup on the GUI that asked me to enable System Extensions from the recovery OS. After doing that and allowing the macFUSE extension, docker build starts as expected.

However it now seems to be stuck on executing the first RUN command.

Even on a simple mkdir or touch command that I'm able to execute from a running docker image if I try to do that.

New output:

$ docker build --progress=plain .
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 113B done
#1 DONE 0.0s

#2 [internal] load metadata for ghcr.io/macoscontainers/macos-jail/ventura:latest
#2 ...

#3 [auth] macoscontainers/macos-jail/ventura:pull token for ghcr.io
#3 DONE 0.0s

#2 [internal] load metadata for ghcr.io/macoscontainers/macos-jail/ventura:latest
#2 DONE 1.1s

#4 [internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [1/2] FROM ghcr.io/macoscontainers/macos-jail/ventura:latest@sha256:fc0f84066d4d6ab6f02941bbe0b2d7beb8211a41d6393b5f676c82212a63308b
#5 CACHED

#6 [2/2] RUN mkdir -p /test
slonopotamus commented 1 year ago

I pushed some updates in https://github.com/macOScontainers/homebrew-formula/commit/e559375f12451bf727ca6e2495d50c78e1c108fd. Could you please try updating, restarting containerd + dockerd, and trying again? If things still do not work, you should be able to see logs in /opt/homebrew/var/log/containerd.log + /opt/homebrew/var/log/dockerd.log.

slonopotamus commented 1 year ago

Oh, wait, I have reproduced this. Debugging what is going wrong...

As a temporary workaround, use DOCKER_BUILDKIT=0 docker build .

slonopotamus commented 1 year ago

Fixed in rund 0.0.6