-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Docker create (rebase of 6907) #7110
Conversation
@tiborvass Thanks! |
@mrunalp Actually, thanks go to you! :) |
-w, --workdir="" Working directory inside the container | ||
|
||
|
||
The `docker create` command `creates` a writeable container layer over |
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 is creates in backticks?
ping :) Any updates? |
Rebased. Ping @vieux @unclejack @crosbymichael |
|
||
c := containers[0] | ||
if c.Path != "command" { | ||
t.Fatalf("Unepexted container path. Expected command, recieved: %s", c.Path) |
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.
s/Unepexted/Unexpected/
This needs rebased after we moved the repo and changed the imports. |
"os/exec" | ||
"testing" | ||
|
||
"github.com/dotcloud/docker/daemon" |
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.
these two imports should be docker/docker
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.
Actually don't import these in the integration tests, you can make an adhoc type for unmarshaling the data you want.
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.
will do
Usage: docker create [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] | ||
|
||
|
||
-a, --attach=[] Attach to stdin, stdout or stderr. |
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.
STDIN, etc
Fixed docs. |
return fmt.Errorf("Failed to create the container ID file: %s", err) | ||
if !cid.written { | ||
if err := os.Remove(cid.path); err != nil { | ||
return fmt.Errorf("failed to remove CID file '%s': %s \n", cid.path, err) |
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 this should read: ".. the CID file ..", instead of ".. remove CID file .."
Fixed docs again. Ping @jamtur01 @ostezer |
@@ -42,7 +42,27 @@ type HostConfig struct { | |||
CapDrop []string | |||
} | |||
|
|||
// This is used by the create command when you want to both set the | |||
// Config and the HostConfig in the same call | |||
type ConfigAndHostConfig struct { |
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.
This request is backwards compatible right?
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.
@crosbymichael I'm not sure what you mean by that, but basically, "create" will set the hostconfig in createContainer
, but "run" will set it in srv.ContainerStart
. In that regard, it (should) work just like before.
We basically create a HostConfig field in Config, that we check for to know if we have to set the hostconfig early on.
Rebased. |
The `docker create` command creates a writeable container layer over | ||
the specified image, and prepares it for running the specified | ||
command. The container ID is then printed to `STDOUT`. This is similar | ||
to what `docker run -d <cli_run>`, does except the container is never |
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.
The comma here seems redundant and I believe it should be removed.
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.
fixed
@alexlarsson @tiborvass: docs mostly LGTM apart from the One final note:
Would it be possible to amend this bit further more? |
@ostezer Is it better? |
@tiborvass wonderful! Thank you. |
@crosbymichael thanks, will update. Sorry about that |
2b5e5a3
to
1218865
Compare
@crosbymichael PTAL |
Ping @crosbymichael |
still needs rebased ;) |
1218865
to
7c32546
Compare
@crosbymichael rebased. PTAL |
sorry it needs to be rebased again because of this:
|
7c32546
to
4eb7cc7
Compare
Rebased |
|
||
func (cli *DockerCli) CmdRun(args ...string) error { | ||
// FIXME: just use runconfig.Parse already | ||
cmd := cli.Subcmd("run", "[OPTIONS] IMAGE [COMMAND] [ARG...]", "Run a command in a new container") |
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.
same problem we had with exec [OPTIONS]
gets printed twice in usage, but also why did this change..?
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.
ohhh this is because of a PR that adds it automatically. thanks will remove!
This exposes the already existing "create container" operation. It is very similar to "docker run -d" except it doesn't actually start the container, but just prepares it. It can then be manually started using "docker start" at any point. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson) Conflicts: api/client/commands.go runconfig/parse.go server/container.go Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson) Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
Signed-off-by: Tibor Vass <teabee89@gmail.com>
Docker-DCO-1.1-Signed-off-by: SvenDowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
Signed-off-by: Tibor Vass <teabee89@gmail.com>
4eb7cc7
to
e49c701
Compare
@jfrazelle updated |
nice! LGTM |
LGTM |
Really should start to require anyone adding a new command to provide man pages. docker exec and docker create both do not have man pages. Also bash-completions should be added. |
bash completions were added for both, and man pages were added for |
@rhatdan |
Looks like I need to rebuild, never mind. |
Closes #6907
Ping @vieux @unclejack @crosbymichael