Skip to content

Commit ca7997e

Browse files
committed
chapter9:optional: add --rm to docker run busybox echo hello world
This commit proposes to replace this command $ docker run busybox echo hello world with $ docker run --rm busybox echo hello world so that docker deletes the container when the container stops. In this chapter, the docker commands never restart a stopped container. Because of that, each `docker run` command could use `--rm` to remove the container when the container stops. Without `--rm`, the stopped containers accumulate. `docker ps -a` shows the stopped containers not yet deleted.
1 parent fee4422 commit ca7997e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

chapter_09_docker.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ Follow those, and then test your installation by running:
496496

497497
[subs="specialcharacters,macros"]
498498
----
499-
$ pass:quotes[*docker run busybox echo hello world*]
499+
$ pass:quotes[*docker run --rm busybox echo hello world*]
500500
Unable to find image 'busybox:latest' locally
501501
[...]
502502
latest: Pulling from library/busybox
@@ -512,6 +512,7 @@ What's happened there is that Docker has:
512512
* Downloaded the image from DockerHub
513513
* Created a container based on that image
514514
* Started up that container, telling it to run `echo hello world`
515+
* Deleted that container when the container stopped
515516
* And we can see it worked!
516517

517518
Cool! We'll find out more about all of these steps as the chapter progresses.

0 commit comments

Comments
 (0)