From 5874dea1b7f23add737889a60fd04c1dec0911da Mon Sep 17 00:00:00 2001 From: Craig Osterhout Date: Tue, 30 May 2023 11:55:42 -0700 Subject: [PATCH 1/5] Update start docs to add examples Signed-off-by: Craig Osterhout --- docs/reference/commandline/start.md | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/docs/reference/commandline/start.md b/docs/reference/commandline/start.md index 866a24921aee..74e10606bafc 100644 --- a/docs/reference/commandline/start.md +++ b/docs/reference/commandline/start.md @@ -22,6 +22,75 @@ Start one or more stopped containers ## Examples +### Start a container + +To start a container, specify the container ID or image name. For example: + ```console $ docker start my_container ``` + +### Start a container and attach to its STDOUT/STDERR + +To start a container and attach to its STDOUT/STDERR and forward signals, use the `--attach` or `-a` option. For example, if you create an nginx container named my_nginx_container, you can start it and monitor its logs using the following: + +```console +$ docker create --name my_nginx_container -p 80:80 nginx +ca5a4351c9c4b43c0b0c69d4d925aa1d8a53a3b33742250ad227f22096accab6 + +$ docker start -a my_nginx_container +/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration +/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ +/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh +... +``` + +### Start a contianer and restore from a checkpoint + +To start a container and restore it from a checkpoint, use the `--checkpoint` option. For example: + +```console +$ docker run --security-opt=seccomp:unconfined --name cr -d busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' +db316bda7d64b4154d207a3d659c90c982d0b35a3e177fc396e809a6a93a147f + +$ docker checkpoint create cr checkpoint1 +checkpoint1 + +# +$ docker start --checkpoint checkpoint1 cr +``` + +### Start a container and restore from a custom checkpoint storage + +To start a container and restore it from a checkpoint in a custom checkpoint storage directory, use the `--checkpoint-dir` option. For example: + +```console +$ docker run --security-opt=seccomp:unconfined --name cr -d busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' +db316bda7d64b4154d207a3d659c90c982d0b35a3e177fc396e809a6a93a147f + +$ docker checkpoint create --checkpoint-dir /path/to/checkpoints cr checkpoint2 +checkpoint2 + +# +$ docker start --checkpoint-dir /path/to/checkpoints --checkpoint checkpoint2 cr +``` + +### Start a container and override the detach key sequence + +To start a container and override the key sequence for detaching a container, use the `--detach-keys` option. For example to change the detach sequence to `ctrl` plus `x`, use the following: + +```console +$ docker start -a --detach-keys="ctrl-x" my_container +``` + +### Start a container and attach to its STDIN + +To start a container and attach to its STDIN, use the `--interactive` or `-i` option. For example, if you create an ubuntu container named my_ubuntu_container, you can start it and interact with its shell using the following: + +```console +$ docker create -it --name my_ubuntu_container ubuntu +6facdc392ec364d53d5cca760791d33b173d89525aff8f6f7c73a68bda0ab33c + +$ docker start -i my_ubuntu_container +root@6facdc392ec3:/# +``` \ No newline at end of file From 830567694824af0e12119d342c834639a679abea Mon Sep 17 00:00:00 2001 From: Craig Osterhout Date: Mon, 5 Jun 2023 15:17:14 -0700 Subject: [PATCH 2/5] Update start docs to add examples - feedback Signed-off-by: Craig Osterhout --- docs/reference/commandline/start.md | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/docs/reference/commandline/start.md b/docs/reference/commandline/start.md index 74e10606bafc..f2d9e7b89def 100644 --- a/docs/reference/commandline/start.md +++ b/docs/reference/commandline/start.md @@ -30,7 +30,15 @@ To start a container, specify the container ID or image name. For example: $ docker start my_container ``` -### Start a container and attach to its STDOUT/STDERR +### Start a container and attach to its STDOUT/STDERR (--attach, -a) + +> This option is experimental. +> +> This command is experimental on the Docker daemon. It should not be used in +> production environments. +> To enable experimental features on the Docker daemon, edit the +> [daemon.json](/engine/reference/commandline/dockerd/ +#daemon-configuration-file) To start a container and attach to its STDOUT/STDERR and forward signals, use the `--attach` or `-a` option. For example, if you create an nginx container named my_nginx_container, you can start it and monitor its logs using the following: @@ -45,7 +53,12 @@ $ docker start -a my_nginx_container ... ``` -### Start a contianer and restore from a checkpoint +### Start a container and restore from a checkpoint (--checkpoint) (experimental) + +The `--checkpoint` option is an experimental feature, and should not be +considered stable. To read about experimental daemon options and how to enable +them, see +[Daemon configuration file](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file). To start a container and restore it from a checkpoint, use the `--checkpoint` option. For example: @@ -60,7 +73,12 @@ checkpoint1 $ docker start --checkpoint checkpoint1 cr ``` -### Start a container and restore from a custom checkpoint storage +### Start a container and restore from a custom checkpoint storage (--checkpoint-dir) (experimental) + +The `--checkpoint-dir` option is an experimental feature, and should not be +considered stable. To read about experimental daemon options and how to enable +them, see +[Daemon configuration file](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file). To start a container and restore it from a checkpoint in a custom checkpoint storage directory, use the `--checkpoint-dir` option. For example: @@ -75,7 +93,7 @@ checkpoint2 $ docker start --checkpoint-dir /path/to/checkpoints --checkpoint checkpoint2 cr ``` -### Start a container and override the detach key sequence +### Start a container and override the detach key sequence (--detach-keys) To start a container and override the key sequence for detaching a container, use the `--detach-keys` option. For example to change the detach sequence to `ctrl` plus `x`, use the following: @@ -83,7 +101,7 @@ To start a container and override the key sequence for detaching a container, us $ docker start -a --detach-keys="ctrl-x" my_container ``` -### Start a container and attach to its STDIN +### Start a container and attach to its STDIN (--interactive, -i) To start a container and attach to its STDIN, use the `--interactive` or `-i` option. For example, if you create an ubuntu container named my_ubuntu_container, you can start it and interact with its shell using the following: From 76caa2b97685c5cbe8f37dc107dea89600a9d59c Mon Sep 17 00:00:00 2001 From: Craig Osterhout Date: Wed, 7 Jun 2023 12:40:35 -0700 Subject: [PATCH 3/5] Update start docs - fix typo Signed-off-by: Craig Osterhout --- docs/reference/commandline/start.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docs/reference/commandline/start.md b/docs/reference/commandline/start.md index f2d9e7b89def..0a3b1817cf39 100644 --- a/docs/reference/commandline/start.md +++ b/docs/reference/commandline/start.md @@ -32,14 +32,6 @@ $ docker start my_container ### Start a container and attach to its STDOUT/STDERR (--attach, -a) -> This option is experimental. -> -> This command is experimental on the Docker daemon. It should not be used in -> production environments. -> To enable experimental features on the Docker daemon, edit the -> [daemon.json](/engine/reference/commandline/dockerd/ -#daemon-configuration-file) - To start a container and attach to its STDOUT/STDERR and forward signals, use the `--attach` or `-a` option. For example, if you create an nginx container named my_nginx_container, you can start it and monitor its logs using the following: ```console From 0430c02fa73d103e784077b364e924ef83588ddd Mon Sep 17 00:00:00 2001 From: Craig Osterhout Date: Thu, 8 Jun 2023 11:42:20 -0700 Subject: [PATCH 4/5] Update start docs to add examples - feedback2 Signed-off-by: Craig Osterhout --- docs/reference/commandline/start.md | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/reference/commandline/start.md b/docs/reference/commandline/start.md index 0a3b1817cf39..0b28555b508d 100644 --- a/docs/reference/commandline/start.md +++ b/docs/reference/commandline/start.md @@ -24,7 +24,7 @@ Start one or more stopped containers ### Start a container -To start a container, specify the container ID or image name. For example: +To start a container, specify the container name or ID. For example: ```console $ docker start my_container @@ -32,7 +32,10 @@ $ docker start my_container ### Start a container and attach to its STDOUT/STDERR (--attach, -a) -To start a container and attach to its STDOUT/STDERR and forward signals, use the `--attach` or `-a` option. For example, if you create an nginx container named my_nginx_container, you can start it and monitor its logs using the following: +To start a container and attach to its STDOUT/STDERR and forward signals, use +the `--attach` or `-a` option. For example, if you create an nginx container +named my_nginx_container, you can start it and monitor its logs using the +following: ```console $ docker create --name my_nginx_container -p 80:80 nginx @@ -55,10 +58,10 @@ them, see To start a container and restore it from a checkpoint, use the `--checkpoint` option. For example: ```console -$ docker run --security-opt=seccomp:unconfined --name cr -d busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' +$ docker run --name my_container -d busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' db316bda7d64b4154d207a3d659c90c982d0b35a3e177fc396e809a6a93a147f -$ docker checkpoint create cr checkpoint1 +$ docker checkpoint create my_container checkpoint1 checkpoint1 # @@ -72,22 +75,25 @@ considered stable. To read about experimental daemon options and how to enable them, see [Daemon configuration file](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file). -To start a container and restore it from a checkpoint in a custom checkpoint storage directory, use the `--checkpoint-dir` option. For example: +To start a container and restore it from a checkpoint in a custom checkpoint +storage directory, use the `--checkpoint-dir` option. For example: ```console -$ docker run --security-opt=seccomp:unconfined --name cr -d busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' +$ docker run --name my_container -d busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done' db316bda7d64b4154d207a3d659c90c982d0b35a3e177fc396e809a6a93a147f -$ docker checkpoint create --checkpoint-dir /path/to/checkpoints cr checkpoint2 +$ docker checkpoint create --checkpoint-dir /path/to/checkpoints my_container checkpoint2 checkpoint2 # -$ docker start --checkpoint-dir /path/to/checkpoints --checkpoint checkpoint2 cr +$ docker start --checkpoint-dir /path/to/checkpoints --checkpoint checkpoint2 my_container ``` ### Start a container and override the detach key sequence (--detach-keys) -To start a container and override the key sequence for detaching a container, use the `--detach-keys` option. For example to change the detach sequence to `ctrl` plus `x`, use the following: +To start a container and override the key sequence for detaching a container, +use the `--detach-keys` option. For example to change the detach sequence to +`ctrl` plus `x`, use the following: ```console $ docker start -a --detach-keys="ctrl-x" my_container @@ -95,7 +101,10 @@ $ docker start -a --detach-keys="ctrl-x" my_container ### Start a container and attach to its STDIN (--interactive, -i) -To start a container and attach to its STDIN, use the `--interactive` or `-i` option. For example, if you create an ubuntu container named my_ubuntu_container, you can start it and interact with its shell using the following: +To start a container and attach to its STDIN, use the `--interactive` or `-i` +option. For example, if you create an ubuntu container named +my_ubuntu_container, you can start it and interact with its shell using the +following: ```console $ docker create -it --name my_ubuntu_container ubuntu From 22aff716522a12736b8c612b26b8b03eaa537e45 Mon Sep 17 00:00:00 2001 From: Craig Osterhout Date: Thu, 8 Jun 2023 11:45:35 -0700 Subject: [PATCH 5/5] Update start docs to add examples - fix typo Signed-off-by: Craig Osterhout --- docs/reference/commandline/start.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/commandline/start.md b/docs/reference/commandline/start.md index 0b28555b508d..dbb1ddb7d53a 100644 --- a/docs/reference/commandline/start.md +++ b/docs/reference/commandline/start.md @@ -65,7 +65,7 @@ $ docker checkpoint create my_container checkpoint1 checkpoint1 # -$ docker start --checkpoint checkpoint1 cr +$ docker start --checkpoint checkpoint1 my_container ``` ### Start a container and restore from a custom checkpoint storage (--checkpoint-dir) (experimental)