darwin-containers / rund

OCI Container Runtime for Darwin
Apache License 2.0
432 stars 13 forks source link

Unmatching image platform #27

Closed mircowidmer closed 6 months ago

mircowidmer commented 9 months ago

Great idea!

I tried it out and failed with the following error message:

WARNING: The requested image's platform (unknown) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Before I executed the following commands successfully:

brew install --cask macfuse                                                                                                                                     
brew install docker docker-buildx macOScontainers/formula/bindfs macOScontainers/formula/containerd macOScontainers/formula/dockerd macOScontainers/formula/rund
sudo brew services start containerd                                                                                                                             
sudo brew services start dockerd                                                             
mkdir -p ~/.docker/cli-plugins                                                               
ln -sfn /opt/homebrew/opt/docker-buildx/bin/docker-buildx ~/.docker/cli-plugins/docker-buildx
echo <TOKEN> | docker login ghcr.io -u <GITHUB USERNAME> --password-stdin
docker run --rm -it ghcr.io/macoscontainers/macos-jail/ventura:latest echo "Hello from macOS container ^_^"

I'm running this on this Mac:

Hardware Overview:
  Model Name:                    MacBook Pro
  Model Identifier:                      MacBookPro18,2
  Model Number:                  Z14X0003PSM/A
  Chip:                                       Apple M1 Max
  Total Number of Cores:    10 (8 performance and 2 efficiency)
  Memory:                            64 GB
  System Firmware Version:  10151.1.1
  OS Loader Version:            10151.1.1
  Serial Number (system):   W01GC49049
  Hardware UUID:                    367B2C4C-A4B8-55E4-84F3-7027389DD8E6
  Provisioning UDID:            00006001-0014694101F8801E
  Activation Lock Status:           Enabled
slonopotamus commented 9 months ago

This warning is expected for now, it doesn't prevent things from working and will be fixed one day in https://github.com/macOScontainers/macos-jail/issues/11. Could you please show full output of docker run command?

mircowidmer commented 9 months ago

This warning is expected for now, it doesn't prevent things from working and will be fixed one day in macOScontainers/macos-jail#11. Could you please show full output of docker run command?

Thank you. I just retried all the steps listed on the main page. And now the command echo <TOKEN> | docker login ghcr.io -u <GITHUB USERNAME> --password-stdin never terminates. I realized that I didn't disable the System Integrity Protection, maybe that's the reason why it doesn't end the echo command?

slonopotamus commented 9 months ago

You're supposed to pass your GitHub access token and username in that command. See GitHub Container registry docs on authentication: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry

mircowidmer commented 9 months ago

You're supposed to pass your GitHub access token and username in that command. See GitHub Container registry docs on authentication: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry

Thanks again for your help. I used my real access tokens from GitHub. I even created a new one before trying it out a second time. Furthermore, I just didn't post them here because I don't like them being publicly accessible.

slonopotamus commented 9 months ago

Well, you alternatively can run docker login ghcr.io and just type login + token into it.

Furthermore, I just didn't post them here because I don't like them being publicly accessible

Sure, I just trying random guesses about what could go wrong)

mircowidmer commented 9 months ago
docker login ghcr.io                                                                                       
Authenticating with existing credentials...
Login Succeeded

When I run

docker run --rm -it ghcr.io/macoscontainers/macos-jail/ventura:latest echo "Hello from macOS container ^_^"

I still get the following error and warning:

WARNING: The requested image's platform (unknown) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
exec /bin/echo: exec format error
slonopotamus commented 9 months ago

linux/arm64/v8

Do you have Docker Desktop or something like that running? I should have noticed that in your first message) You're trying to run the image with wrong Docker service.

MichaelVoelkel commented 9 months ago

So, I have the same error and I have Docker Desktop running. How can I elegantly switch between docker "services"?

..

Anyways, did it now, maybe not elegantly, but:

failed to resize tty, using default size

Apparently some docker bug, cool. Is it normal that brew says containerd at 0.0.1 and dockerd at 0.0.2?

..

New terminal and now it gives the usual platform warning (the error about tty has gone!) but not the echo output? Error code 255. But I just saw SIP is enabled, I'll try disable it (although I don't like that too much but...)

slonopotamus commented 9 months ago

0.0.2 is ok, there was an update to fix bind mounts: https://github.com/macOScontainers/rund/issues/14#issuecomment-1734421037

mircowidmer commented 9 months ago

Do you have Docker Desktop or something like that running? I should have noticed that in your first message) You're trying to run the image with wrong Docker service.

Thank you. I tried it again and stopped all docker desktop processes. The only one running was dockerd. Then I executed

```docker run --rm -it ghcr.io/macoscontainers/macos-jail/ventura:latest echo "Hello from macOS container ^_^"````

and I got this error:

Cannot connect to the Docker daemon at unix:///Users/mirco/.docker/run/docker.sock. Is the docker daemon running?

After starting docker desktop again I encountered the existing problem:

WARNING: The requested image's platform (unknown) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
exec /bin/echo: exec format error

How can I switch between the docker services?

christianmscott commented 8 months ago

I was able to get the run working by setting DOCKER_HOST env to the correct docker.sock, which if you installed dockerd via brew as described above, should be found at unix:///var/run/docker.sock

So, export DOCKER_HOST=unix:///var/run/docker.sock

Then try your command again. I still get the platform tag warning, which shouldn't be a big deal. But I don't get any output. I think that could be related to SIP. @slonopotamus can you confirm?

Here's my output:

docker run --rm -it ghcr.io/macoscontainers/macos-jail/ventura:latest echo "Hello from macOS container ^_^"                           
WARNING: The requested image's platform (unknown) does not match the detected host platform (darwin/arm64/v8) and no specific platform was requested
slonopotamus commented 8 months ago

Platform warning is harmless. I created https://github.com/macOScontainers/macos-jail/issues/11 to fix it eventually (need some time to figure out how to publish multiplatform image). Not sure why you're not getting any output though. Will try to figure out where logs are written when Docker works as a service...

slonopotamus commented 7 months ago

I pushed some updates in https://github.com/macOScontainers/homebrew-formula/commit/e559375f12451bf727ca6e2495d50c78e1c108fd. Could you please try updating, restarting containerd + dockerd, and running 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.