Skip to content
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

Merged
merged 6 commits into from
Sep 16, 2014
Merged

Docker create (rebase of 6907) #7110

merged 6 commits into from
Sep 16, 2014

Conversation

tiborvass
Copy link
Contributor

@mrunalp
Copy link
Contributor

mrunalp commented Jul 18, 2014

@tiborvass Thanks!

@tiborvass
Copy link
Contributor Author

@mrunalp Actually, thanks go to you! :)

-w, --workdir="" Working directory inside the container


The `docker create` command `creates` a writeable container layer over
Copy link
Contributor

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?

@mrunalp
Copy link
Contributor

mrunalp commented Jul 24, 2014

ping :) Any updates?

@tiborvass
Copy link
Contributor Author

Rebased. Ping @vieux @unclejack @crosbymichael


c := containers[0]
if c.Path != "command" {
t.Fatalf("Unepexted container path. Expected command, recieved: %s", c.Path)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Unepexted/Unexpected/

@crosbymichael
Copy link
Contributor

This needs rebased after we moved the repo and changed the imports.

"os/exec"
"testing"

"github.com/dotcloud/docker/daemon"
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

@SvenDowideit
Copy link
Contributor

Docs LGTM - @jamtur01 @fredlf @ostezer

Usage: docker create [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...]


-a, --attach=[] Attach to stdin, stdout or stderr.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STDIN, etc

@tiborvass
Copy link
Contributor Author

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)
Copy link

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 .."

@tiborvass
Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@tiborvass
Copy link
Contributor Author

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
Copy link

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ghost
Copy link

ghost commented Jul 31, 2014

@alexlarsson @tiborvass: docs mostly LGTM apart from the ID issue.

One final note:

<cli_start> and <cli_run> expressions do not really seem clear to me.
I'm not sure if docs here, as is, would make a lot of sense to everyone.

Would it be possible to amend this bit further more?

@tiborvass
Copy link
Contributor Author

@ostezer Is it better?

@ghost
Copy link

ghost commented Jul 31, 2014

@tiborvass wonderful! Thank you.

@tiborvass
Copy link
Contributor Author

@crosbymichael thanks, will update. Sorry about that

@tiborvass
Copy link
Contributor Author

@crosbymichael PTAL

@tiborvass
Copy link
Contributor Author

Ping @crosbymichael

@crosbymichael
Copy link
Contributor

still needs rebased ;)

@tiborvass
Copy link
Contributor Author

@crosbymichael rebased. PTAL

@jessfraz
Copy link
Contributor

sorry it needs to be rebased again because of this:

--- FAIL: TestTagInvalidPrefixedRepo (0.08 seconds)
    docker_cli_tag_test.go:64: tag busybox repo:f should have failed

@tiborvass
Copy link
Contributor Author

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")
Copy link
Contributor

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..?

Copy link
Contributor Author

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!

alexlarsson and others added 6 commits September 16, 2014 18:40
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)
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>
@tiborvass
Copy link
Contributor Author

@jfrazelle updated

@jessfraz
Copy link
Contributor

nice! LGTM

@LK4D4
Copy link
Contributor

LK4D4 commented Sep 16, 2014

LGTM

LK4D4 added a commit that referenced this pull request Sep 16, 2014
Docker create (rebase of 6907)
@LK4D4 LK4D4 merged commit ca39a3e into moby:master Sep 16, 2014
@rhatdan
Copy link
Contributor

rhatdan commented Sep 17, 2014

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.

@jessfraz
Copy link
Contributor

bash completions were added for both, and man pages were added for create looking into exec now

@jessfraz
Copy link
Contributor

@rhatdan exec updated man pages as well

@rhatdan
Copy link
Contributor

rhatdan commented Sep 17, 2014

Looks like I need to rebuild, never mind.

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.