From 304d39cc505ff51682dd7e1337f9f0ab7536eec3 Mon Sep 17 00:00:00 2001 From: Roberto Gandolfo Hashioka Date: Thu, 7 Nov 2013 14:06:49 -0800 Subject: [PATCH 1/3] - Fix the attach examples according to the new attach behavior - Add the option of adding the user to docker's group and avoid the usage of "sudo" before each command --- docs/sources/examples/hello_world.rst | 3 ++- docs/sources/examples/python_web_app.rst | 5 +++-- docs/sources/examples/running_ssh_service.rst | 3 ++- docs/sources/use/basics.rst | 7 +++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/sources/examples/hello_world.rst b/docs/sources/examples/hello_world.rst index 6d6c1b28a..d6f75de09 100644 --- a/docs/sources/examples/hello_world.rst +++ b/docs/sources/examples/hello_world.rst @@ -127,10 +127,11 @@ Check the logs make sure it is working correctly. sudo docker attach $CONTAINER_ID -Attach to the container to see the results in realtime. +Attach to the container to see the results in real-time. - **"docker attach**" This will allow us to attach to a background process to see what is going on. +- **"-sig-proxy=true" Proxify all received signal to the process (even in non-tty mode) - **$CONTAINER_ID** The Id of the container we want to attach too. Exit from the container attachment by pressing Control-C. diff --git a/docs/sources/examples/python_web_app.rst b/docs/sources/examples/python_web_app.rst index c707fcdec..71e7ae4e0 100644 --- a/docs/sources/examples/python_web_app.rst +++ b/docs/sources/examples/python_web_app.rst @@ -39,11 +39,12 @@ container. The ``BUILD_JOB`` environment variable will be set with the new conta .. code-block:: bash - sudo docker attach $BUILD_JOB + sudo docker attach -sig-proxy=false $BUILD_JOB [...] While this container is running, we can attach to the new container to -see what is going on. You can use Ctrl-C to disconnect. +see what is going on. The flag ``-sig-proxy`` set as ``false`` allows you to connect and +disconnect (Ctrl-C) to it without stopping the container. .. code-block:: bash diff --git a/docs/sources/examples/running_ssh_service.rst b/docs/sources/examples/running_ssh_service.rst index 59a80fbf6..e0d406bc0 100644 --- a/docs/sources/examples/running_ssh_service.rst +++ b/docs/sources/examples/running_ssh_service.rst @@ -21,7 +21,8 @@ smooth, but gives you a good idea. daemon is unprotected and available via a TCP port. When you run through the same steps in a newer version of Docker, you will need to add ``sudo`` in front of each ``docker`` command in order - to reach the daemon over its protected Unix socket. + to reach the daemon over its protected Unix socket or you can add + your user to docker's group: ``sudo usermod -a -G docker ``. .. raw:: html diff --git a/docs/sources/use/basics.rst b/docs/sources/use/basics.rst index 0097b6836..8773fa949 100644 --- a/docs/sources/use/basics.rst +++ b/docs/sources/use/basics.rst @@ -54,6 +54,13 @@ the daemon starts. The ``docker`` daemon must always run as root, but if you run the ``docker`` client as a user in the *docker* group then you don't need to add ``sudo`` to all the client commands. +Alternative to ``sudo``? +------------- + +You can add your current ```` to docker's group and get rid of +``sudo`` before each ``docker`` command. You just need to type: +``$ sudo usermod -a -G docker `` + .. code-block:: bash # Add the docker group From eba3c36b386f389953eda6315948577200c9bf2c Mon Sep 17 00:00:00 2001 From: Roberto Gandolfo Hashioka Date: Thu, 7 Nov 2013 14:44:07 -0800 Subject: [PATCH 2/3] - Included the sudo alternative as an example_header --- docs/sources/examples/example_header.inc | 6 ++++++ docs/sources/examples/running_ssh_service.rst | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/sources/examples/example_header.inc b/docs/sources/examples/example_header.inc index 607421fc1..7d0feddeb 100644 --- a/docs/sources/examples/example_header.inc +++ b/docs/sources/examples/example_header.inc @@ -2,3 +2,9 @@ .. note:: This example assumes you have Docker running in daemon mode. For more information please see :ref:`running_examples` + +.. note:: + + These examples use ``sudo`` before each ``docker`` command you could also + add your current ```` to docker's group and get rid of ``sudo``. + You just need to type: ``$ sudo usermod -a -G docker `` diff --git a/docs/sources/examples/running_ssh_service.rst b/docs/sources/examples/running_ssh_service.rst index e0d406bc0..59a80fbf6 100644 --- a/docs/sources/examples/running_ssh_service.rst +++ b/docs/sources/examples/running_ssh_service.rst @@ -21,8 +21,7 @@ smooth, but gives you a good idea. daemon is unprotected and available via a TCP port. When you run through the same steps in a newer version of Docker, you will need to add ``sudo`` in front of each ``docker`` command in order - to reach the daemon over its protected Unix socket or you can add - your user to docker's group: ``sudo usermod -a -G docker ``. + to reach the daemon over its protected Unix socket. .. raw:: html From 9a9d3239e10b55cc15bb38788a411d9a16c477fc Mon Sep 17 00:00:00 2001 From: Andy Rothfusz Date: Fri, 15 Nov 2013 11:38:03 -0800 Subject: [PATCH 3/3] Fix typos, add links, streamline content of #2592 --- docs/sources/examples/example_header.inc | 9 +++---- docs/sources/examples/hello_world.rst | 3 ++- docs/sources/use/basics.rst | 33 +++++++++++------------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/docs/sources/examples/example_header.inc b/docs/sources/examples/example_header.inc index 7d0feddeb..0621b3979 100644 --- a/docs/sources/examples/example_header.inc +++ b/docs/sources/examples/example_header.inc @@ -1,10 +1,7 @@ .. note:: - This example assumes you have Docker running in daemon mode. For more information please see :ref:`running_examples` + * This example assumes you have Docker running in daemon mode. For + more information please see :ref:`running_examples`. + * **If you don't like sudo** then see :ref:`dockergroup` -.. note:: - - These examples use ``sudo`` before each ``docker`` command you could also - add your current ```` to docker's group and get rid of ``sudo``. - You just need to type: ``$ sudo usermod -a -G docker `` diff --git a/docs/sources/examples/hello_world.rst b/docs/sources/examples/hello_world.rst index d6f75de09..99eaa2c48 100644 --- a/docs/sources/examples/hello_world.rst +++ b/docs/sources/examples/hello_world.rst @@ -131,7 +131,8 @@ Attach to the container to see the results in real-time. - **"docker attach**" This will allow us to attach to a background process to see what is going on. -- **"-sig-proxy=true" Proxify all received signal to the process (even in non-tty mode) +- **"-sig-proxy=true"** Proxify all received signal to the process + (even in non-tty mode) - **$CONTAINER_ID** The Id of the container we want to attach too. Exit from the container attachment by pressing Control-C. diff --git a/docs/sources/use/basics.rst b/docs/sources/use/basics.rst index 30444c4f8..0b3fafced 100644 --- a/docs/sources/use/basics.rst +++ b/docs/sources/use/basics.rst @@ -53,39 +53,36 @@ Running an interactive shell .. _dockergroup: -Why ``sudo``? -------------- +sudo and the docker Group +------------------------- The ``docker`` daemon always runs as root, and since ``docker`` version 0.5.2, ``docker`` binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user *root*, and so, by default, you can access it with ``sudo``. -Starting in version 0.5.3, if you create a Unix group called *docker* -and add users to it, then the ``docker`` daemon will make the -ownership of the Unix socket read/writable by the *docker* group when -the daemon starts. The ``docker`` daemon must always run as root, but -if you run the ``docker`` client as a user in the *docker* group then -you don't need to add ``sudo`` to all the client commands. +Starting in version 0.5.3, if you (or your Docker installer) create a +Unix group called *docker* and add users to it, then the ``docker`` +daemon will make the ownership of the Unix socket read/writable by the +*docker* group when the daemon starts. The ``docker`` daemon must +always run as root, but if you run the ``docker`` client as a user in +the *docker* group then you don't need to add ``sudo`` to all the +client commands. -Alternative to ``sudo``? -------------- - -You can add your current ```` to docker's group and get rid of -``sudo`` before each ``docker`` command. You just need to type: -``$ sudo usermod -a -G docker `` +**Example:** .. code-block:: bash - # Add the docker group + # Add the docker group if it doesn't already exist. sudo groupadd docker - # Add the ubuntu user to the docker group + # Add the user "ubuntu" to the docker group. + # Change the user name to match your preferred user. # You may have to logout and log back in again for - # this to take effect + # this to take effect. sudo gpasswd -a ubuntu docker - # Restart the docker daemon + # Restart the docker daemon. sudo service docker restart .. _bind_docker: