How to pass an options in ENTRYPOINT when building image?

I’m trying to build image with Dockerfile like below:

ENTRYPOINT [“python3”, “test.py”, “-t”, “arg1”]
#ENTRYPOINT [“python3”, “test.py”, “-t”, “arg2”]
#ENTRYPOINT [“python3”, “test.py”, “-t”, “arg3”]

How can I pass option to ENTRYPOINT when building image instead build 3 different images respectively?

Thanks

You use the entrypoint as a command, but the entrypoint should be used as just a part of the command. the CMD insttruction will be the argument of the entrypoint and you can pass any argument when you run the container. So the question doesn’t really make sense, as even if you use build arguments to use different arguments for the entrypoint, you still build mmultiple images.

If you want to understand entrypoints and commands and how you can define what command will actually run in the container, you can read my blogpost and also check the video where I run the commands mentioned in the blogpost.