mirror of https://github.com/docker/docs.git
Merge pull request #19416 from mlaventure/warn-on-rm-detach
Print an info message when detaching a container started with --rm
This commit is contained in:
commit
245d6e83a9
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
"github.com/docker/docker/pkg/promise"
|
"github.com/docker/docker/pkg/promise"
|
||||||
"github.com/docker/docker/pkg/signal"
|
"github.com/docker/docker/pkg/signal"
|
||||||
|
"github.com/docker/docker/pkg/stringid"
|
||||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||||
"github.com/docker/engine-api/types"
|
"github.com/docker/engine-api/types"
|
||||||
"github.com/docker/libnetwork/resolvconf/dns"
|
"github.com/docker/libnetwork/resolvconf/dns"
|
||||||
|
@ -260,6 +261,16 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
|
|
||||||
// Attached mode
|
// Attached mode
|
||||||
if *flAutoRemove {
|
if *flAutoRemove {
|
||||||
|
// Warn user if they detached us
|
||||||
|
js, err := cli.client.ContainerInspect(createResponse.ID)
|
||||||
|
if err != nil {
|
||||||
|
return runStartContainerErr(err)
|
||||||
|
}
|
||||||
|
if js.State.Running == true || js.State.Paused == true {
|
||||||
|
fmt.Fprintf(cli.out, "Detached from %s, awaiting its termination in order to uphold \"--rm\".\n",
|
||||||
|
stringid.TruncateID(createResponse.ID))
|
||||||
|
}
|
||||||
|
|
||||||
// Autoremove: wait for the container to finish, retrieve
|
// Autoremove: wait for the container to finish, retrieve
|
||||||
// the exit code and remove the container
|
// the exit code and remove the container
|
||||||
if status, err = cli.client.ContainerWait(createResponse.ID); err != nil {
|
if status, err = cli.client.ContainerWait(createResponse.ID); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue