Skip to content

Commit

Permalink
Fix examples in README to no longer rely on standalone mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Solomon Hykes committed Apr 19, 2013
1 parent deb55e4 commit 3ae5c45
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,26 @@ Some streamlined (but possibly outdated) installation paths' are available from
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
# Download a base image
Expand All @@ -145,9 +163,6 @@ Starting a long-running worker process
--------------------------------------
```bash
# Run docker in daemon mode
(docker -d || echo "Docker daemon already running") &
# Start a very useful long-running process
JOB=$(docker run -d base /bin/sh -c "while true; do echo Hello world; sleep 1; done")
Expand Down
21 changes: 5 additions & 16 deletions docs/sources/examples/running_examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,16 @@
Running The Examples
--------------------

There are two ways to run docker, daemon mode and standalone mode.

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.
All the examples assume your machine is running the docker daemon. To run the docker daemon in the background, simply type:

.. code-block:: bash
# starting docker daemon in the background
sudo docker -d &
# now you can run docker commands from any account.
docker <command>
2. Standalone: You need to run every command as root, or using sudo
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
sudo docker <command>
# now you can run docker commands from any account.
docker help

0 comments on commit 3ae5c45

Please sign in to comment.