Situation
It is necessary to build a Docker image from the Dockerfile, but the built image always has the same architecture as the current PC from which the build was started. However, in some cases, it could be necessary to build the image of another architecture.
Question
How to build the Docker image from Dockerfile with architecture that differs from the current machine?
Answer
The --platform key could be added to the Dockerfile run configuration. To do it, perform the following steps:
- open the
Run | Edit Configurations...window; - select or create a new Dockerfile configuration;
- add the Build options field to the configuration as shown in the screenshot below:
- add the
--platformoption to the Build options field and specify the necessary platform as described in the official documentation.
Comments
0 comments
Please sign in to leave a comment.