skip to Main Content

I have a docker file, that is built from the base image node:bullseye-slim

Following is the basic docker file

FROM  --platform=linux/amd64  node:bullseye-slim
RUN cat /etc/apt/sources.list
RUN apt-get update -y

RUN apt-get install curl -y

Initially I was not using --platform=linux/amd64, and the build completed without an error, but this resulted it in building the image in arm/64 architecture which resulted in problems running the image. Based on my search I found out adding --platform=linux/amd64 will make sure the image is built on x86 architecture as required by one of the libraries I use.

So I decided to add --platform=linux/amd64. But since then when ever I try to build the image it gets stuck on RUN apt-get update -y step.
I have left it running over night (over 10 hours) and still it stuck on the step.

I also ran the build with he flag --progress=plain to get more detailed logs but there are no logs for apt-get update and it seems to be just stuck on the step.

The output is as following

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 30B
#1 transferring dockerfile: 331B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 34B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/node:bullseye-slim
#3 DONE 1.2s

#4 [1/8] FROM docker.io/library/node:bullseye-slim@sha256:22a517a42af0f2bf961e12daa3a940244e5ddf450c6da6c0e245b652f1027713
#4 DONE 0.0s

#5 [2/8] RUN cat /etc/apt/sources.list
#5 CACHED

#6 [internal] load build context
#6 transferring context: 757B done
#6 DONE 0.0s

#7 [3/8] RUN apt-get update -y

I am running this on the new MacBook Pro 14 inch with M1 Pro chip.

I have tried running docker system prune -a and trying building again, and still gets stuck. I have tried using node:bullseye instead of node:bullseye-slim but it still got stuck. If I remove --platform=linux/amd64 the build completes with no issues.

Any idea what the issue is and how can I resolve it ?

2

Answers


  1. Chosen as BEST ANSWER

    So, It seems like restarting docker worked, I can't believe I did not think of that before. I did system prune but never restarted docker.

    For any one else facing similar issue, try restarting docker


  2. Use that platform with arm64 like

    FROM --platform=linux/arm64/v8 node:bullseye-slim

    You can search the exact platform name with arm64 on the docker hub against each image and use that to make it work in Mac Apple Silicone

    enter image description here
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search