From a6fe2179efa00b1e0fed15b2c720bd992713feb1 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Mon, 1 Oct 2018 17:20:57 +0100 Subject: [PATCH] docker: combine start/stop, add basic run example (#2363) The start and stop examples are pretty much identical, so it doesn't make sense to use up the space of two examples in the limited length of a tldr page (especially for such a complex command as docker). In the slot left by combining the two entries, a new one is added mentioning how to launch a container from an image. Placing this example before the start/stop commands (and naming the parameter "container_name" consistently trhoughout the page) also makes the sequence more logical, by first explaining how containers are instantiated, and only then mentioning how they are managed. --- pages/common/docker.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pages/common/docker.md b/pages/common/docker.md index 14c2d1c96..cb3c53b16 100644 --- a/pages/common/docker.md +++ b/pages/common/docker.md @@ -10,13 +10,13 @@ `docker container ls -a` -- Start a container: +- Start a container from an image, with a custom name: -`docker container start {{container}}` +`docker container run --name={{container_name}} {{image}}` -- Stop a container: +- Start or stop an existing container: -`docker container stop {{container}}` +`docker container {{start|stop}} {{container_name}}` - Start a container from an image and get a shell inside of it: @@ -24,12 +24,12 @@ - Run a command inside of an already running container: -`docker container exec {{container}} {{command}}` +`docker container exec {{container_name}} {{command}}` - Remove a stopped container: -`docker container rm {{container}}` +`docker container rm {{container_name}}` - Fetch and follow the logs of a container: -`docker container logs -f {{container}}` +`docker container logs -f {{container_name}}`