Skip to content

Instantly share code, notes, and snippets.

@thockin
Created January 14, 2015 00:26
Show Gist options
  • Save thockin/c44a88b84c2a1041a1bd to your computer and use it in GitHub Desktop.
Save thockin/c44a88b84c2a1041a1bd to your computer and use it in GitHub Desktop.
```
| No ENTRYPOINT | ENTRYPOINT entry | ENTRYPOINT ["entry"] |
------------+-----------------+------------------------------ ---+-----------------------|
No CMD | <error> | /bin/sh -c entry | entry |
CMD cmd | /bin/sh -c cmd | /bin/sh -c entry /bin/sh -c cmd | entry /bin/sh -c cmd |
CMD ["cmd"] | cmd | /bin/sh -c entry cmd | entry cmd |
------------------------------------------------------------------------------------------
```
@jenisys
Copy link

jenisys commented Dec 12, 2015

An additional dimension is missing:
Are command-line args provided to "docker run CONTAINER" or not (and should they be used or ignored).
In this case only both exec modes (lower right cell) works as expected for me.

Therefore, there are only 2 use cases (IMHO, independent of the combinations above):

  • container supports command-line args (and command-line args may override default args)
    => USE: Both exec mode.
  • container should ignore any command-line args in "docker run CONTAINER ..."
    => USE: Other cases (but use either only CMD or only ENTRYPOINT for readability/clarity).
    BETTER: Use only ENTRYPOINT in shell mode (other cases lead to weird problems).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment