mirror of https://github.com/docker/docs.git
Merge pull request #4526 from Rovanion/master
All caps variables in normal bash should be avoided not to accidentally collide with environment variables.
This commit is contained in:
commit
2ad16c88e2
|
@ -52,8 +52,8 @@ This command will run a simple ``echo`` command, that will echo ``hello world``
|
||||||
|
|
||||||
**Explanation:**
|
**Explanation:**
|
||||||
|
|
||||||
- **"sudo"** execute the following commands as user *root*
|
- **"sudo"** execute the following commands as user *root*
|
||||||
- **"docker run"** run a command in a new container
|
- **"docker run"** run a command in a new container
|
||||||
- **"busybox"** is the image we are running the command in.
|
- **"busybox"** is the image we are running the command in.
|
||||||
- **"/bin/echo"** is the command we want to run in the container
|
- **"/bin/echo"** is the command we want to run in the container
|
||||||
- **"hello world"** is the input for the echo command
|
- **"hello world"** is the input for the echo command
|
||||||
|
@ -67,9 +67,9 @@ See the example in action
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
||||||
<iframe width="560" height="400" frameborder="0"
|
<iframe width="560" height="400" frameborder="0"
|
||||||
sandbox="allow-same-origin allow-scripts"
|
sandbox="allow-same-origin allow-scripts"
|
||||||
srcdoc="<body><script type="text/javascript"
|
srcdoc="<body><script type="text/javascript"
|
||||||
src="https://asciinema.org/a/7658.js"
|
src="https://asciinema.org/a/7658.js"
|
||||||
id="asciicast-7658" async></script></body>">
|
id="asciicast-7658" async></script></body>">
|
||||||
</iframe>
|
</iframe>
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ we stop it.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
CONTAINER_ID=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done")
|
container_id=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done")
|
||||||
|
|
||||||
We are going to run a simple hello world daemon in a new container
|
We are going to run a simple hello world daemon in a new container
|
||||||
made from the ``ubuntu`` image.
|
made from the ``ubuntu`` image.
|
||||||
|
@ -104,22 +104,22 @@ made from the ``ubuntu`` image.
|
||||||
- **"while true; do echo hello world; sleep 1; done"** is the mini
|
- **"while true; do echo hello world; sleep 1; done"** is the mini
|
||||||
script we want to run, that will just print hello world once a
|
script we want to run, that will just print hello world once a
|
||||||
second until we stop it.
|
second until we stop it.
|
||||||
- **$CONTAINER_ID** the output of the run command will return a
|
- **$container_id** the output of the run command will return a
|
||||||
container id, we can use in future commands to see what is going on
|
container id, we can use in future commands to see what is going on
|
||||||
with this process.
|
with this process.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
sudo docker logs $CONTAINER_ID
|
sudo docker logs $container_id
|
||||||
|
|
||||||
Check the logs make sure it is working correctly.
|
Check the logs make sure it is working correctly.
|
||||||
|
|
||||||
- **"docker logs**" This will return the logs for a container
|
- **"docker logs**" This will return the logs for a container
|
||||||
- **$CONTAINER_ID** The Id of the container we want the logs for.
|
- **$container_id** The Id of the container we want the logs for.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
sudo docker attach -sig-proxy=false $CONTAINER_ID
|
sudo docker attach -sig-proxy=false $container_id
|
||||||
|
|
||||||
Attach to the container to see the results in real-time.
|
Attach to the container to see the results in real-time.
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ Attach to the container to see the results in real-time.
|
||||||
process to see what is going on.
|
process to see what is going on.
|
||||||
- **"-sig-proxy=false"** Do not forward signals to the container; allows
|
- **"-sig-proxy=false"** Do not forward signals to the container; allows
|
||||||
us to exit the attachment using Control-C without stopping the container.
|
us to exit the attachment using Control-C without stopping the container.
|
||||||
- **$CONTAINER_ID** The Id of the container we want to attach too.
|
- **$container_id** The Id of the container we want to attach too.
|
||||||
|
|
||||||
Exit from the container attachment by pressing Control-C.
|
Exit from the container attachment by pressing Control-C.
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ Check the process list to make sure it is running.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
sudo docker stop $CONTAINER_ID
|
sudo docker stop $container_id
|
||||||
|
|
||||||
Stop the container, since we don't need it anymore.
|
Stop the container, since we don't need it anymore.
|
||||||
|
|
||||||
- **"docker stop"** This stops a container
|
- **"docker stop"** This stops a container
|
||||||
- **$CONTAINER_ID** The Id of the container we want to stop.
|
- **$container_id** The Id of the container we want to stop.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -162,9 +162,9 @@ See the example in action
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
|
|
||||||
<iframe width="560" height="400" frameborder="0"
|
<iframe width="560" height="400" frameborder="0"
|
||||||
sandbox="allow-same-origin allow-scripts"
|
sandbox="allow-same-origin allow-scripts"
|
||||||
srcdoc="<body><script type="text/javascript"
|
srcdoc="<body><script type="text/javascript"
|
||||||
src="https://asciinema.org/a/2562.js"
|
src="https://asciinema.org/a/2562.js"
|
||||||
id="asciicast-2562" async></script></body>">
|
id="asciicast-2562" async></script></body>">
|
||||||
</iframe>
|
</iframe>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue