Skip to content

Update doc: "docker create" must specify a command - #11210

Merged
crosbymichael merged 1 commit into
moby:masterfrom
xuhdev:patch-1
Mar 17, 2015
Merged

crosbymichael merged 1 commit into
moby:masterfrom
xuhdev:patch-1

Conversation

@xuhdev

@xuhdev xuhdev commented Mar 6, 2015

Copy link
Copy Markdown
Contributor

No description provided.

@GordonTheTurtle

Copy link
Copy Markdown
Contributor

Can you please sign your commits following these rules:

https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work

The easiest way to do this is to amend the last commit:

$ git clone -b "patch-1" [email protected]:xuhdev/docker.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

This will update the existing PR, so you do not need to open a new one.

@estesp

estesp commented Mar 6, 2015

Copy link
Copy Markdown
Contributor

Actually, [COMMAND] is optional as the command-line reference docs show. The image being created from may already have a command or entrypoint defined. In this specific case, the command is already set up for you in the image: https://registry.hub.docker.com/u/training/postgres/dockerfile/

@xuhdev

xuhdev commented Mar 6, 2015

Copy link
Copy Markdown
Contributor Author

It's not critical, but it is just better to replace the command with a dummy one. The reason to do this is that if someone accidentially start the data container, there will be no additional process to change the data in the container.

@SvenDowideit

Copy link
Copy Markdown
Contributor

@xuhdev thats a really good explanation of why you've done it, and I think you're right, especially for something like postgres - where the default COMMAND / ENTRYPOINT would start a complete new postgres server!

Could you add that explanation to your change?

@estesp

estesp commented Mar 6, 2015

Copy link
Copy Markdown
Contributor

Ugh.. I looked more at your PR title than the context of where you are changing the code. Just FYI--for busy people, a brief title that gives a closer representation of what you are doing is good, and an initial commit comment that explains can be helpful too! :) Other than my own personal problems, @SvenDowideit is exactly right.. for a data container it does make sense to replace the entrypoint!

The other thing I've seen in blogs documenting data volumes is that usually people don't understand why it's not recommended to use a "small" image like busybox but rather the same image as your runtime like this example is showing; don't know if this doc should be updated with the reasoning that I've seen elsewhere, but basically if your runtime container and data container are based from the same image, then all those layers are shared, but if the data container is "some other image", then you will actually waste more space for even the "small" content of your data volume image.

"docker create" for data containers should specify a dummy command to
avoid accidential "docker start" to cause unexpected data loss.

Signed-off-by: Hong Xu <[email protected]>
@xuhdev

xuhdev commented Mar 6, 2015

Copy link
Copy Markdown
Contributor Author

Sorry for the confusion, now updated :)

@estesp I agree that using the same image can save space, but I don't think a busybox image is really large for most cases... Besides, if the data container and the runtime container are built on the same image, some changes i.e. upgrading from runtime container from an old version to a new version without touching the data container actually leads to larger space usage.

@jessfraz

Copy link
Copy Markdown
Contributor

LGTM, I think there has been a lot of back and forth but someone else can feel free to make another patch explaining it will also use the entrypoint if otherwise, perhaps @SvenDowideit

@crosbymichael

Copy link
Copy Markdown
Contributor

LGTM

crosbymichael added a commit that referenced this pull request Mar 17, 2015
Update doc: "docker create" must specify a command
@crosbymichael
crosbymichael merged commit e6b18cb into moby:master Mar 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants