Docker joins ENTRYPOINT
and CMD
into single command line, if both use JSON notation, like in your example.
This is JSON notation: CMD [ "dotnet", "/app/netcore/Somename.dll"]
This is shell notation: CMD dotnet /app/netcore/Somename.dll
Another thing you need to know - what is written in docker run ... <image_name> ...
after - considered as CMD
.
So, to conclude.
The constant (immutable) part of command line, like dotnet foo.dll
you can put in ENTRYPOINT
.
Variable part, like additional arguments, you supply with docker run
and optionally put defaults to CMD
in Dockerfile
Example:
Dockerfile
...
ENTRYPOINT ["dotnet", "/app/netcore/Somename.dll"]
CMD ["--help"]
Command line 1:
docker run ... <your image name> --environment=Staging --port=8080
Will result in dotnet /app/netcore/Somename.dll --environment=Staging --port=8080
Command line 2:
docker run ... <your image name>
Will result in dotnet /app/netcore/Somename.dll --help
. --help
comes from default value, defined in Dockerfile.