Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add instructions for running Docker images on M1 #1336

Closed
wants to merge 1 commit into from

Conversation

brunopgalvao
Copy link
Contributor

By specifying the --platform=linux/amd64 flag, the image can run on M1 computers otherwise with the current instructions the images fail to run on M1 hardware.

By specifying the `--platform=linux/amd64 ` flag, the image can run on M1 computers otherwise with the current instructions the images fail to run on M1 hardware.
@bkchr
Copy link
Member

bkchr commented Jun 7, 2022

Why would you want to compile the collator for linux when you want to run it on Mac?

@brunopgalvao
Copy link
Contributor Author

When I try to run the following on an M1 Mac:

$ docker run --rm -it -w /shellhere/cumulus \
                    -v $(pwd):/shellhere/cumulus \
                    paritytech/ci-linux:production cargo build --release --locked -p polkadot-parachain 
sudo chown -R $(id -u):$(id -g) target/

I get the following:

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

And I am unable to run the image.

However, if I add --platform=linux/amd64, it works.

Copy link
Contributor

@nuke-web3 nuke-web3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to hear it was that simple

@bkchr
Copy link
Member

bkchr commented Jun 8, 2022

When I try to run the following on an M1 Mac:

$ docker run --rm -it -w /shellhere/cumulus \
                    -v $(pwd):/shellhere/cumulus \
                    paritytech/ci-linux:production cargo build --release --locked -p polkadot-parachain 
sudo chown -R $(id -u):$(id -g) target/

I get the following:

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

And I am unable to run the image.

However, if I add --platform=linux/amd64, it works.

Yeah, that sounds plausible. What I wanted to point out is that the binary in target will not be able to be used on mac os.

Copy link
Contributor

@gilescope gilescope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default platform for docker so no harm being explicit.

@nuke-web3
Copy link
Contributor

Any blockers here? Or can we merge this?

@bkchr
Copy link
Member

bkchr commented Jun 21, 2022

Any blockers here? Or can we merge this?

Has someone done the steps and then checked that it works? I still don't see how a linux binary can be run on Mac os.

@brunopgalvao
Copy link
Contributor Author

brunopgalvao commented Jun 21, 2022

AFAIU, Docker is running a linux container on my Mac. I would expect it to request by default a linux/amd64 image. Instead it detects the "host platform" which is in my case linux/arm64/v8 and in our case the requested image does not exist. That is why explicitly specifying --platform=linux/amd64, grabs a linux image that runs fine on the macOS Docker instance that is running a linux vm.

Found this on the Docker site:

Docker Desktop for Apple silicon also supports multi-platform images, which allows you to build and run images for both x86 and ARM architectures without having to set up a complex cross-compilation development environment.

Maybe this is why it detects the host platform.

@bkchr
Copy link
Member

bkchr commented Jun 23, 2022

@brunopgalvao have you repeated the steps that are written inside the README? And by that I mean also to execute the binary?

@brunopgalvao
Copy link
Contributor Author

Okay so I ran through the steps. You are right. The binary will not run on macOS. You can see in the video below.

Feel free to close this.

docker-m1.mov

@bkchr bkchr closed this Jun 24, 2022
@bkchr bkchr deleted the bg-m1-docker-usage branch June 24, 2022 21:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
B0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants