Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmd option to change default architecture #36

Merged
merged 1 commit into from
Oct 24, 2021

Conversation

computeralex92
Copy link
Contributor

I added a command line option to colima to change the used architecture.

Why?

Sometimes I have the need to run on a M1 a docker container which is only for Intel based environments build.
A ARM-based colima environment have some issues with it:

$ docker run --platform linux/amd64 alpine:latest uname -a
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
a0d0a0d46f8b: Pull complete
Digest: sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a
Status: Downloaded newer image for alpine:latest
standard_init_linux.go:228: exec user process caused: exec format error

After change

$ ./_output/colima-amd64 start -a x86_64
INFO[0000] starting colima
INFO[0000] creating and starting ...                     context=vm
INFO[0321] provisioning ...                              context=docker
INFO[0321] provisioning in VM ...                        context=docker
INFO[0484] restarting VM to complete setup ...           context=docker
INFO[0485] stopping ...                                  context=vm
INFO[0508] starting ...                                  context=vm
INFO[0622] starting ...                                  context=docker
INFO[0663] done
$ docker run --platform linux/amd64 alpine:latest uname -a
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
a0d0a0d46f8b: Pull complete
Digest: sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a
Status: Downloaded newer image for alpine:latest
Linux d2bdff871931 5.13.0-19-generic #19-Ubuntu SMP Thu Oct 7 21:58:00 UTC 2021 x86_64 Linux

Trade Off

The disk speed of the VM is quite bad compared to the native ARM environment; but I didn't speed test it yet.

@abiosoft
Copy link
Owner

Thanks for this.

Are you using Colima on an M1 device?

@abiosoft abiosoft merged commit 2179c52 into abiosoft:main Oct 24, 2021
@computeralex92
Copy link
Contributor Author

Thanks for this.

Are you using Colima on an M1 device?

Yes, I'm using it on a M1.

@computeralex92 computeralex92 deleted the add-architecture-option branch October 24, 2021 18:39
@abiosoft
Copy link
Owner

Yes, I'm using it on a M1.

Good to hear 🎉 . Now I can update the readme accordingly.

@abiosoft abiosoft added this to the v0.3.0 milestone Oct 26, 2021
@abiosoft
Copy link
Owner

@computeralex92 Hi, if you would not mind helping with testing, multiple instances support has been added with the --profile flag.

Rather than deleting and recreating for arm and x86 docker images, you can now simply have multiple instances and shut down the ones you're not using.

The following will create a colima instance with profile name x86 independent of your other instance(s).

colima start --profile x86 --arch aarch64

This is currently on the main branch and I am looking to make it part of the next release.

@abiosoft
Copy link
Owner

This should not require creating multiple instances anymore. A solution is in the works.

@abiosoft
Copy link
Owner

FYI, this now works out of the box and no additional steps is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants