From 39aac21db47b3bcbf651008267ad1142f1213103 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sat, 30 Nov 2013 10:58:52 -0500 Subject: [PATCH] Updated and simplified the PG example --- docs/sources/examples/postgresql_service.rst | 39 +++++++------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/docs/sources/examples/postgresql_service.rst b/docs/sources/examples/postgresql_service.rst index 82ca8b59ca..c57b3c41f2 100644 --- a/docs/sources/examples/postgresql_service.rst +++ b/docs/sources/examples/postgresql_service.rst @@ -7,26 +7,18 @@ PostgreSQL Service ================== +.. include:: example_header.inc + .. note:: A shorter version of `this blog post`_. -.. note:: - - As of version 0.5.2, Docker requires root privileges to run. - You have to either manually adjust your system configuration (permissions on - /var/run/docker.sock or sudo config), or prefix `docker` with `sudo`. Check - `this thread`_ for details. - .. _this blog post: http://zaiste.net/2013/08/docker_postgresql_how_to/ -.. _this thread: https://groups.google.com/forum/?fromgroups#!topic/docker-club/P3xDLqmLp0E Installing PostgreSQL on Docker ------------------------------- -For clarity I won't be showing command output. - -Run an interactive shell in Docker container. +Run an interactive shell in a Docker container. .. code-block:: bash @@ -38,19 +30,17 @@ Update its dependencies. apt-get update -Install ``python-software-properties``. +Install ``python-software-properties``, ``software-properties-common``, ``wget`` and ``vim``. .. code-block:: bash - apt-get -y install python-software-properties - apt-get -y install software-properties-common + apt-get -y install python-software-properties software-properties-common wget vim Add PostgreSQL's repository. It contains the most recent stable release -of PostgreSQL i.e. ``9.3``. +of PostgreSQL, ``9.3``. .. code-block:: bash - apt-get -y install wget wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list apt-get update @@ -78,15 +68,14 @@ role. Adjust PostgreSQL configuration so that remote connections to the database are possible. Make sure that inside -``/etc/postgresql/9.3/main/pg_hba.conf`` you have following line (you will need -to install an editor, e.g. ``apt-get install vim``): +``/etc/postgresql/9.3/main/pg_hba.conf`` you have following line: .. code-block:: bash host all all 0.0.0.0/0 md5 Additionaly, inside ``/etc/postgresql/9.3/main/postgresql.conf`` -uncomment ``listen_addresses`` so it is as follows: +uncomment ``listen_addresses`` like so: .. code-block:: bash @@ -104,14 +93,14 @@ Exit. exit -Create an image and assign it a name. ```` is in the -Bash prompt; you can also locate it using ``docker ps -a``. +Create an image from our container and assign it a name. The ```` +is in the Bash prompt; you can also locate it using ``docker ps -a``. .. code-block:: bash sudo docker commit /postgresql -Finally, run PostgreSQL server via ``docker``. +Finally, run the PostgreSQL server via ``docker``. .. code-block:: bash @@ -121,8 +110,8 @@ Finally, run PostgreSQL server via ``docker``. -D /var/lib/postgresql/9.3/main \ -c config_file=/etc/postgresql/9.3/main/postgresql.conf') -Connect the PostgreSQL server using ``psql`` (You will need postgres installed -on the machine. For ubuntu, use something like +Connect the PostgreSQL server using ``psql`` (You will need PostgreSQL installed +on the machine. For Ubuntu, use something like ``sudo apt-get install postgresql``). .. code-block:: bash @@ -140,7 +129,7 @@ As before, create roles or databases if needed. docker=# CREATE DATABASE foo OWNER=docker; CREATE DATABASE -Additionally, publish your newly created image on Docker Index. +Additionally, publish your newly created image on the Docker Index. .. code-block:: bash