Docker entrypoint and cmd together

Can't tell much without knowing what the entrypoint does, but essentially this is what you are doing with this combination of entrypoint and cmd:

/start.sh aptly api serve

If you are after simply starting your server you can simply do something like this (valid path to the aptly executable may be neccessary):

ENTRYPOINT ["aptly"]
CMD ["api", "serve"]

Unless you are doing much more than just running an executable there's no need for an entrypoint.


One important note, since nobody else has mentioned it: in order to use ENTRYPOINT and CMD together, you need to specify both in the array format. Doing something like this WILL NOT WORK:

ENTRYPOINT ./my_script.sh
CMD echo "hello world"

In the code above, ./my_script.sh will be called, but CMD will not be passed in.


When you use both entrypoint and command, the command section will be appended to entrypoint executable as arguments. Thus in your case:

ENTRYPOINT ["/start.sh"]
CMD ["aptly", "api", "serve"]

Is equivalent to running:

ENTRYPOINT["/start.sh", "aptly", "api", "serve"]