mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix examples in README to no longer rely on standalone mode
This commit is contained in:
parent
deb55e416e
commit
3ae5c45d9a
2 changed files with 25 additions and 21 deletions
25
README.md
25
README.md
|
@ -122,8 +122,26 @@ Some streamlined (but possibly outdated) installation paths' are available from
|
||||||
Usage examples
|
Usage examples
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Running an interactive shell
|
First run the docker daemon
|
||||||
----------------------------
|
---------------------------
|
||||||
|
|
||||||
|
All the examples assume your machine is running the docker daemon. To run the docker daemon in the background, simply type:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
sudo docker -d &
|
||||||
|
|
||||||
|
Now you can run docker in client mode: all commands will be forwarded to the docker daemon, so the client
|
||||||
|
can run from any account.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# now you can run docker commands from any account.
|
||||||
|
docker help
|
||||||
|
|
||||||
|
|
||||||
|
Throwaway shell in a base ubuntu image
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download a base image
|
# Download a base image
|
||||||
|
@ -145,9 +163,6 @@ Starting a long-running worker process
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run docker in daemon mode
|
|
||||||
(docker -d || echo "Docker daemon already running") &
|
|
||||||
|
|
||||||
# Start a very useful long-running process
|
# Start a very useful long-running process
|
||||||
JOB=$(docker run -d base /bin/sh -c "while true; do echo Hello world; sleep 1; done")
|
JOB=$(docker run -d base /bin/sh -c "while true; do echo Hello world; sleep 1; done")
|
||||||
|
|
||||||
|
|
|
@ -7,27 +7,16 @@
|
||||||
Running The Examples
|
Running The Examples
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
There are two ways to run docker, daemon mode and standalone mode.
|
All the examples assume your machine is running the docker daemon. To run the docker daemon in the background, simply type:
|
||||||
|
|
||||||
When you run the docker command it will first check if there is a docker daemon running in the background it can connect to.
|
|
||||||
|
|
||||||
* If it exists it will use that daemon to run all of the commands.
|
|
||||||
* If it does not exist docker will run in standalone mode (docker will exit after each command).
|
|
||||||
|
|
||||||
Docker needs to be run from a privileged account (root).
|
|
||||||
|
|
||||||
1. The most common (and recommended) way is to run a docker daemon as root in the background, and then connect to it from the docker client from any account.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# starting docker daemon in the background
|
|
||||||
sudo docker -d &
|
sudo docker -d &
|
||||||
|
|
||||||
# now you can run docker commands from any account.
|
Now you can run docker in client mode: all commands will be forwarded to the docker daemon, so the client
|
||||||
docker <command>
|
can run from any account.
|
||||||
|
|
||||||
2. Standalone: You need to run every command as root, or using sudo
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
sudo docker <command>
|
# now you can run docker commands from any account.
|
||||||
|
docker help
|
||||||
|
|
Loading…
Add table
Reference in a new issue