pycon.tw icon indicating copy to clipboard operation
pycon.tw copied to clipboard

[Deployment] Fail to build the Docker images

Open mattwang44 opened this issue 3 years ago • 4 comments

Description

Fail to build the Docker images from both Dockerfile and dev.Dockerfile:

  • Cannot find the correct version of psycopg2.
  • Cannot build Pillow successfully.

mattwang44 avatar May 15 '22 16:05 mattwang44

It turns out that this issue only happened on M1.

mattwang44 avatar May 18 '22 02:05 mattwang44

This could be solved by adding export DOCKER_DEFAULT_PLATFORM=linux/amd64 to your environment. I think we don't need to modify Dockerfile and docker-compose.yml only for running on M1 machines.

josix avatar Jun 13 '22 07:06 josix

@josix agreed, but how about adding some comments hinting M1 users to solve such issue?

mattwang44 avatar Jun 13 '22 07:06 mattwang44

I added a checker in enter_dev_env.sh.to and set DOCKER_DEFAULT_PLATFORM to linux/amd64 when detecting the machine is arm64, please have a look, thanks! I'm not sure if there are other places that should notify users of this configuration, feel free to let me know if somewhere could be updated.

josix avatar Jun 13 '22 08:06 josix

I guess this is solved by #1082, right? @mattwang44

josix avatar Nov 28 '22 10:11 josix

IIRC it does work on some of our M1s but adding platform: x86_64 to each service defined in docker compose file seems to be a more common solution (I'm not sure how will this change affect other platforms, so I didnt check-in this change to the repo).

mattwang44 avatar Nov 28 '22 17:11 mattwang44

let's close it for now

mattwang44 avatar Mar 20 '24 05:03 mattwang44