1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

21 commits

Author SHA1 Message Date
Daniel Nephin
0640a14b4f Move api/client -> cli/command
Using
  gomvpkg
     -from github.com/docker/docker/api/client
     -to github.com/docker/docker/cli/command
     -vcs_mv_cmd 'git mv {{.Src}} {{.Dst}}'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 15:46:29 -04:00
Daniel Nephin
6af6a3a538 Move holdHijackConnection to the container package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 12:58:06 -04:00
Daniel Nephin
31d8c27e70 Move container util methods to the container package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 12:38:52 -04:00
Daniel Nephin
bec81075bf Extract input stream into a new type.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 12:34:55 -04:00
Daniel Nephin
a0ab33124a Extract stream output handling to a new type.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 12:33:41 -04:00
Michael Crosby
91e197d614 Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-07 11:05:58 -07:00
Antonio Murdaca
c2c2617534
api: client: container: update: fix help text
Before:

$ docker update --cpu-period
Status: flag needs an argument: --cpu-period
See 'docker update --help'., Code: 125

After:

$ docker update --cpu-period
flag needs an argument: --cpu-period
See 'docker update --help'.

Also remove flagErrorFunc function which isn't needed anymore.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-08-31 12:46:40 +02:00
Daniel Nephin
14712f9ff0 Remove old cli framework.
Also consolidate the leftover packages under cli.
Remove pkg/mflag.
Make manpage generation work with new cobra layout.
Remove remaining mflag and fix tests after rebase with master.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-08-25 13:09:04 -04:00
Daniel Nephin
31bf9ca0c8 Update unit tests for new cobra root command.
Cleanup cobra integration
Update windows files for cobra and pflags
Cleanup SetupRootcmd, and remove unnecessary SetFlagErrorFunc.
Use cobra command traversal

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-08-25 13:09:04 -04:00
Zhang Wei
4754c64ab5 Forbid update restart policy of container with AutoRemove flag
"--restart" and "--rm" are conflict options, if a container is started
with AutoRemove flag, we should forbid the update action for its Restart
Policy.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-08-16 15:36:13 +08:00
Zhang Wei
a422813113 Bugfix: client hangs after run container
New codes introduced a new method to wait container's exit code and
removal via Events API, but it specified a "since" filter based on
client side clock, which sometimes isn't synced up with daemon's clock,
hence leads the client to hang on waiting container's exit status.

This commit brings the Events call before start, and removes the time
filter, so that it can catch daemon events correctly without care of the
clock issue.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-08-10 09:36:06 +08:00
Zhang Wei
6dd8e10d6e Wait container's removal via Events API
If AutoRemove is set, wait until client get `destroy` events, or get
`detach` events that implies container is detached but not stopped.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-08-08 22:46:53 +08:00
Zhang Wei
3c2886d8a4 Move --rm to daemon side
`--rm` is a client side flag which caused lots of problems:
1. if client lost connection to daemon, including client crash or be
killed, there's no way to clean garbage container.
2. if docker stop a `--rm` container, this container won't be
autoremoved.
3. if docker daemon restart, container is also left over.
4. bug: `docker run --rm busybox fakecmd` will exit without cleanup.

In a word, client side `--rm` flag isn't sufficient for garbage
collection. Move the `--rm` flag to daemon will be more reasonable.

What this commit do is:
1. implement a `--rm` on daemon side, adding one flag `AutoRemove` into
HostConfig.
2. Allow `run --rm -d`, no conflicting `--rm` and `-d` any more,
auto-remove can work on detach mode.
3. `docker restart` a `--rm` container will succeed, the container won't
be autoremoved.

This commit will help a lot for daemon to do garbage collection for
temporary containers.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-08-08 22:46:53 +08:00
Alexander Morozov
ed5d335e22 api,daemon: cleanup some unused stuff
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-06-21 14:15:19 -07:00
Vincent Demeester
4dafd107ad Merge pull request #22777 from WeiZhang555/wait-restarting
Bug fix: `docker run -i --restart always` hangs
2016-06-12 13:01:20 +02:00
Zhang Wei
c111b7eb3d Move GetExitCode to package container and unexport it
GetExitCode is used only by container package, so move it to package
container and unexport it

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-09 18:04:53 +08:00
Zhang Wei
7702f39fe8 Migrate rm command to cobra
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-07 22:19:16 +08:00
Zhang Wei
c498d4700d Bug fix: docker run -i --restart always hangs.
e.g.
```
$ docker run -i --restart always busybox sh
pwd
/
exit 11

<...hang...>
```

This is because Attach(daemon side) and Run(client side) both hangs on
WaitStop, if container is restarted too quickly, wait won't have chance
to get exit signal.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-06 10:16:07 +08:00
Zhang Wei
b4740e3021 Log and print original error for start
Currently `start` will hide some errors and throw a consolidated error,
which will make it hard to debug because developer can't find the
original error.

This commit allow daemon to log original errors first.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-06 10:13:49 +08:00
Daniel Nephin
5ab2434225 Convert 'docker create' to use cobra and pflag
Return the correct status code on flag parsins errors.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-04 13:57:30 +02:00
Daniel Nephin
a77f2450c7 Convert 'docker run' to a cobra command and to use pflags
Move container options into a struct so that tests should pass.
Remove unused FlagSet arg from Parse
Disable interspersed args on docker run

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-04 13:55:35 +02:00
Renamed from api/client/run.go (Browse further)