-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Update best practices for entrypoint. #10724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a831685
to
81e25f0
Compare
The best use for `ENTRYPOINT` is as a helper script. Using `ENTRYPOINT` for | ||
other tasks can make your code harder to understand. For example, | ||
The best use for `ENTRYPOINT` is to set the image's main command, allowing that | ||
image to be run as though it was that command (and then to use `CMD` the default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its missing an "as".
...then to use CMD
as the default options).
yayyy thanks @SvenDowideit you da best :D |
|
||
COPY ./docker-entrypoint.sh / | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
||
This script will allow the user to just start Postgres: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will help to give the reader a heads up for what is coming. E.g., "This script allows the user to interact with Postgres in several ways. It can simply start Postgres: $ docker run postgres
. Or, it can be used to run Postgres and pass parameters to the server: $ docker run postgres postres --help
. Lastly, it could also be used to start a totally different tool, such Bash:
Needs a few edits/revisions to clear up some ambiguities. |
758a4ad
to
c580340
Compare
other tasks can make your code harder to understand. For example, | ||
The best use for `ENTRYPOINT` is to set the image's main command, allowing that | ||
image to be run as though it was that command (and then use `CMD` as the default | ||
options). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flags?
Despite being wrong we are kinda calling our users dumb, I feel it is a bit demeaning. As well as just wrong. Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <princess@docker.com> (github: jfrazelle) Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <hugs@docker.com> (github: jfrazelle)
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
c580340
to
3c9d45e
Compare
LGTM |
@@ -626,8 +626,7 @@ ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] | |||
|
|||
If you need to write a starter script for a single executable, you can ensure that | |||
the final executable receives the Unix signals by using `exec` and `gosu` | |||
(see [the Dockerfile best practices](/articles/dockerfile_best-practices/#entrypoint) | |||
for more details): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we remove this link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that link doesn't tell the reader anything about exec
and gosu
- and much of the content about using ENTRYPOINT
isn't there, its in the builder doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, okay. I see there's a link to the Best Practices doc at the top of the page, so I'm fine removing this one, then.
LGTM |
Update best practices for entrypoint.
Update best practices for entrypoint. (cherry picked from commit 1d27930)
takeover #10470
@jfrazelle :)