Upload local image from non-x86_64 env

I would like to upload a local image from my Apple M1 machine. Should this be possible when using docker buildx build --platform linux/amd64 to build it? If so: Is there a way of bypassing Local docker is not x86_64, hooking you up with a remote Docker builder?

When using flyctl deploy --local-only, I see a Local docker unavailable and --local-only was passed, cannot proceed. instead, so this does not help either.

flyctl doesn’t support docker on M1 yet while we wait on a few other libraries to add support first. Until then you can build and push outside flyctl like this:

# authenticate docker
flyctl auth docker

# build and tag with docker
docker buildx build --platform linux/amd64 -t registry.fly.io/your-app:tag ......

# push to your app's repo in the fly registry
docker push registry.fly.io/your-app:tag

# deploy the image you just pushed
flyctl deploy -i registry.fly.io/your-app:tag
1 Like

Great, thanks a lot!

@thomas1 we have a build for M1 Macs: Friday flyctl update: M1 builds and new VM commands

Could you give it a try again?

@michael, thanks for the update!

I’m still getting INFO Local docker is not x86_64, hooking you up with a remote Docker builder... when deploying via flyctl deploy and Error Local docker unavailable and --local-only was passed, cannot proceed when doing so via flyctl deploy --local-only.

flyctl v0.0.177 darwin/arm64 Commit: 90230d9 BuildDate: 2021-02-19T18:22:45Z

@thomas1 Sorry for the delay. The newest version (v0.0.181) removes the x86_64 check I overlooked earlier. Could you try again?

@michael, the upload works fine now! However, I get a vX failed - Failed due to unhealthy allocations - rolling back to job version Y. The logs:

Recent Events
TIMESTAMP            TYPE            MESSAGE                                                                                                 
2021-03-05T15:22:17Z Received        Task received by client                                                                                 
2021-03-05T15:22:17Z Task Setup      Building Task Directory                                                                                 
2021-03-05T15:22:27Z Driver Failure  rpc error: code = Unknown desc = error waiting for vsock readiness: vsock connection attempts exhausted 
2021-03-05T15:22:27Z Not Restarting  Error was unrecoverable                                                                                 
2021-03-05T15:22:27Z Alloc Unhealthy Unhealthy because of failed task                                                                        
2021-03-05T15:22:27Z Killing         Sent interrupt. Waiting 5s before force killing                                                         

Recent Logs
2021-03-05T15:22:19Z [info] Configuring virtual machine
2021-03-05T15:22:19Z [info] Pulling container image
2021-03-05T15:22:20Z [info] Unpacking image
2021-03-05T15:22:20Z [info] Preparing kernel init
2021-03-05T15:22:20Z [info] Configuring firecracker
2021-03-05T15:22:20Z [info] Starting virtual machine
2021-03-05T15:22:21Z [info] Starting init (commit: c1dec69)...
2021-03-05T15:22:21Z [info] Running: `docker-entrypoint.sh npm start` as root
2021-03-05T15:22:21Z [info] Error: UnhandledIoError(Os { code: 8, kind: Other, message: "Exec format error" })
2021-03-05T15:22:21Z [info] [    0.127448] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100

Would this imply that the buildx target platform is incorrect?

Wow sure looks that way! What kind of binary is that, golang?


Oh, npm, I see that now. That is almost definitely an arm binary.

1 Like

Uh, as I’m very bad at RTFM, I missed the --load flag when running buildx. So while I was building for amd, I was still uploading the local arm image. :man_facepalming:

2 Likes

Did you get it working? I can rtfm on docker stuff over and over and still miss basic things. It’s special that way.

1 Like

Yep, up and running. Thanks for checking in!

1 Like