Closes #17516
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
| ... | ... |
@@ -13,6 +13,7 @@ import ( |
| 13 | 13 |
"github.com/docker/docker/opts" |
| 14 | 14 |
"github.com/docker/docker/pkg/promise" |
| 15 | 15 |
"github.com/docker/docker/pkg/signal" |
| 16 |
+ "github.com/docker/docker/pkg/stringid" |
|
| 16 | 17 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
| 17 | 18 |
"github.com/docker/engine-api/types" |
| 18 | 19 |
"github.com/docker/libnetwork/resolvconf/dns" |
| ... | ... |
@@ -260,6 +261,16 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
| 260 | 260 |
|
| 261 | 261 |
// Attached mode |
| 262 | 262 |
if *flAutoRemove {
|
| 263 |
+ // Warn user if they detached us |
|
| 264 |
+ js, err := cli.client.ContainerInspect(createResponse.ID) |
|
| 265 |
+ if err != nil {
|
|
| 266 |
+ return runStartContainerErr(err) |
|
| 267 |
+ } |
|
| 268 |
+ if js.State.Running == true || js.State.Paused == true {
|
|
| 269 |
+ fmt.Fprintf(cli.out, "Detached from %s, awaiting its termination in order to uphold \"--rm\".\n", |
|
| 270 |
+ stringid.TruncateID(createResponse.ID)) |
|
| 271 |
+ } |
|
| 272 |
+ |
|
| 263 | 273 |
// Autoremove: wait for the container to finish, retrieve |
| 264 | 274 |
// the exit code and remove the container |
| 265 | 275 |
if status, err = cli.client.ContainerWait(createResponse.ID); err != nil {
|