diff --git a/docs/sources/examples/example_header.inc b/docs/sources/examples/example_header.inc new file mode 100644 index 0000000000..e7fbc42fc3 --- /dev/null +++ b/docs/sources/examples/example_header.inc @@ -0,0 +1,4 @@ + +.. warning:: + + This example assumes that you have Docker running in daemon mode. For more information please see :ref:`running_examples` \ No newline at end of file diff --git a/docs/sources/examples/hello_world.rst b/docs/sources/examples/hello_world.rst index f7d455f803..0156aa958b 100644 --- a/docs/sources/examples/hello_world.rst +++ b/docs/sources/examples/hello_world.rst @@ -6,8 +6,10 @@ Hello World =========== -This is the most basic example available for using Docker. The example assumes you have Docker installed. +.. include:: example_header.inc + +This is the most basic example available for using Docker. The example assumes you have Docker installed. Download the base container diff --git a/docs/sources/examples/hello_world_daemon.rst b/docs/sources/examples/hello_world_daemon.rst index 8453952058..7ca251aec8 100644 --- a/docs/sources/examples/hello_world_daemon.rst +++ b/docs/sources/examples/hello_world_daemon.rst @@ -6,6 +6,9 @@ Hello World Daemon ================== + +.. include:: example_header.inc + The most boring daemon ever written. This example assumes you have Docker installed and with the base image already imported ``docker pull base``. @@ -18,7 +21,7 @@ out every second. It will continue to do this until we stop it. CONTAINER_ID=$(docker run -d base /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 made from the busybox daemon. +We are going to run a simple hello world daemon in a new container made from the base image. - **"docker run -d "** run a command in a new container. We pass "-d" so it runs as a daemon. - **"base"** is the image we want to run the command inside of. diff --git a/docs/sources/examples/index.rst b/docs/sources/examples/index.rst index 0ab2143a30..5c70ff4926 100644 --- a/docs/sources/examples/index.rst +++ b/docs/sources/examples/index.rst @@ -12,6 +12,7 @@ Contents: .. toctree:: :maxdepth: 1 + running_examples hello_world hello_world_daemon python_web_app diff --git a/docs/sources/examples/python_web_app.rst b/docs/sources/examples/python_web_app.rst index 3adfeec6d6..7b7edc05e3 100644 --- a/docs/sources/examples/python_web_app.rst +++ b/docs/sources/examples/python_web_app.rst @@ -6,6 +6,9 @@ Building a python web app ========================= + +.. include:: example_header.inc + The goal of this example is to show you how you can author your own docker images using a parent image, making changes to it, and then saving the results as a new image. We will do that by making a simple hello flask web application image. **Steps:** diff --git a/docs/sources/examples/running_examples.rst b/docs/sources/examples/running_examples.rst new file mode 100644 index 0000000000..222c22982d --- /dev/null +++ b/docs/sources/examples/running_examples.rst @@ -0,0 +1,32 @@ +:title: Running the Examples +:description: An overview on how to run the docker examples +:keywords: docker, examples, how to + +.. _running_examples: + +Running The Examples +-------------------- + +There are two ways to run docker, daemon and standalone mode. + +When you run the docker command it will first check to see if there is already a docker daemon running in the background it can connect too, and if so, it will use that daemon to run all of the commands. + +If there is no daemon then docker will run in standalone mode. + +Docker needs to be run from a privileged account (root). Depending on which mode you are using, will determine how you need to execute docker. + +1. The most common 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 + + # starting docker daemon in the background + $ sudo docker -d & + + # now you can run docker commands from any account. + $ docker + +2. Standalone: You need to run every command as root, or using sudo + + .. code-block:: bash + + $ sudo docker diff --git a/docs/sources/examples/running_ssh_service.rst b/docs/sources/examples/running_ssh_service.rst index 23d2d41c2f..f418b45266 100644 --- a/docs/sources/examples/running_ssh_service.rst +++ b/docs/sources/examples/running_ssh_service.rst @@ -7,7 +7,7 @@ Create an ssh daemon service ============================ - +.. include:: example_header.inc **Video:**