This can’t be the exact Dockerfile you used, as the CMD line has a syntax error.
The base image python:3 doesn’t use ENTRYPOINT, as such the CMD instruction should be executed, unless the service in your compose file that based on your image declares entrypoint: or command:, as both would override the CMD instruction from the Dockerfile.
Furthermore, please format your text by using a “</> Preformated Text” block.
Because CMD and ENTRYPOINT work in tandem, they can often be confusing to understand. However, they have different effects and exist to increase your image’s flexibility: ENTRYPOINT sets the process to run, while CMD supplies default arguments to that process
Only true if both are used. Without an ENTRYPOINT instruction (either inherited by the base image or declared in the Dockerfile), the CMD instruction specifies the default process to run and it’s arguments.
There is a statement in your post and the title “CMD line is ignored”, which simply never happens, and there is no explanation why you think it is ignored. So there is nothing to answer here. That’s why I didn’t write before and followed the discussion to see where it goes.
So why do you think it? Despite the replies mentioning entrypoint and cmd you haven’t addressed what you didn’t understand or why you thought it was irrelevant. It is extremely important to understand the keywords in an answer and if you don’t, even after reading the linked documentations, ask for more explanation pointing out what you didn’t understand.
You run docker-compose build. Now why do you think the CMD line should have any affect during building the image? What was that you expected to see and you didn’t see.
These things in a technical question are always important regardless of what the topic is, not just in case of Docker. Otherwise you can say the line is ignored, and we can say it isn’t. And that’s the end of the discussion.
Now if you want to learn about the entrypoint and cmd and when these are running, you can read my blogpost. There is also a video in the post embedded from youtube:
I write and talk about all the instructions related to command executions. In your case, I think CMD is irrelevant, as you don’t run a container, just build the image.