Has anyone had success with containers
Has anyone had success with containers on ARM based macs? getting container errors on both base OS and in a devcontainer on mac. Everything seems to be configured correctly but can't get it to fetch properly. Even the cloudflare examples don't seem to be working. Haven't tested on an x86 machine yet
5 Replies
we developed it on arm based macs, so it definitely works at least sometimes, but you're not the first person to report this - just a bit tricky to debug because i can't actually reproduce this on my machine :( can you share what errors are you getting? are you using docker desktop or something else?
Thanks for the response!
I'm using docker desktop and getting a few different errors.
When I try to run any container in dev mode on macos, I am getting an error:
Uncaught Error: internal error; reference = 7bv0t336ctkelh3dcf74ua99
. This error gets thrown the second any container related functions get called (start, fetch, etc).
I am able to get around this error by running wrangler in a devcontainer. Using the devcontainer allows me to at least get a minimal container running in local mode, but it seems to run into issues with QEMU emulation and dbus errors when trying to use playwright in the container image.
Running on macOS uses @cloudflare/workerd-darwin-arm64
and the devcontainer uses @cloudflare/workerd-linux-arm64
. Not sure if that is relevant, but could explain the difference between the two.
I'll get you a repo with a reproducible example and more of the error / environment info
Is the dev environment containerized in a devcontainer or run directly on macos? If it is containerized, are you using docker in docker or docker outside of docker?
My environment is typically macos running docker desktop / docker, and then the devcontainer is a linux arm64 image using docker in docker.just docker directly on macOS, using docker desktop or colima both have worked. Usually when I’ve seen the totally unhelpful “internal error” stuff it’s a socket issue. Can you verify the docker daemon is listening at the default socket at unix:///var/run/docker.sock? if you’ve got some other socket path, you’ll need to set the env var WRANGLER_DOCKER_HOST
Thank you that was it! For some reason the
unix:///var/run/docker.sock
socket was symlinked to an old user account that was deleted. Using the docker host environment var fixed the issue running on the OS.
After digging into it more, the other errors I am getting are qemu emulation errors from running amd64 instructions on arm64 and aren't specific to the wrangler runtime.
I know the containers get deployed to linux/amd64, but is there a way to override the platform for local development to use arm64? It looks like the constructBuildCommand
in containers-shared/build.ts
takes in an argument for platform, but it doesn't look like there is currently a way to override it.Yeah we’re thinking about adding an option to let users set their own build commands - no current way to do this unfortunately, short of patching wrangler I guess 😅