Conflicts:
docs/sources/examples/postgresql_service.rst
| ... | ... |
@@ -7,26 +7,18 @@ |
| 7 | 7 |
PostgreSQL Service |
| 8 | 8 |
================== |
| 9 | 9 |
|
| 10 |
-.. note:: |
|
| 11 |
- |
|
| 12 |
- A shorter version of `this blog post`_. |
|
| 10 |
+.. include:: example_header.inc |
|
| 13 | 11 |
|
| 14 | 12 |
.. note:: |
| 15 | 13 |
|
| 16 |
- As of version 0.5.2, Docker requires root privileges to run. |
|
| 17 |
- You have to either manually adjust your system configuration (permissions on |
|
| 18 |
- /var/run/docker.sock or sudo config), or prefix `docker` with `sudo`. Check |
|
| 19 |
- `this thread`_ for details. |
|
| 14 |
+ A shorter version of `this blog post`_. |
|
| 20 | 15 |
|
| 21 | 16 |
.. _this blog post: http://zaiste.net/2013/08/docker_postgresql_how_to/ |
| 22 |
-.. _this thread: https://groups.google.com/forum/?fromgroups#!topic/docker-club/P3xDLqmLp0E |
|
| 23 | 17 |
|
| 24 | 18 |
Installing PostgreSQL on Docker |
| 25 | 19 |
------------------------------- |
| 26 | 20 |
|
| 27 |
-For clarity I won't be showing command output. |
|
| 28 |
- |
|
| 29 |
-Run an interactive shell in Docker container. |
|
| 21 |
+Run an interactive shell in a Docker container. |
|
| 30 | 22 |
|
| 31 | 23 |
.. code-block:: bash |
| 32 | 24 |
|
| ... | ... |
@@ -38,19 +30,17 @@ Update its dependencies. |
| 38 | 38 |
|
| 39 | 39 |
apt-get update |
| 40 | 40 |
|
| 41 |
-Install ``python-software-properties``. |
|
| 41 |
+Install ``python-software-properties``, ``software-properties-common``, ``wget`` and ``vim``. |
|
| 42 | 42 |
|
| 43 | 43 |
.. code-block:: bash |
| 44 | 44 |
|
| 45 |
- apt-get -y install python-software-properties |
|
| 46 |
- apt-get -y install software-properties-common |
|
| 45 |
+ apt-get -y install python-software-properties software-properties-common wget vim |
|
| 47 | 46 |
|
| 48 | 47 |
Add PostgreSQL's repository. It contains the most recent stable release |
| 49 |
-of PostgreSQL i.e. ``9.3``. |
|
| 48 |
+of PostgreSQL, ``9.3``. |
|
| 50 | 49 |
|
| 51 | 50 |
.. code-block:: bash |
| 52 | 51 |
|
| 53 |
- apt-get -y install wget |
|
| 54 | 52 |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - |
| 55 | 53 |
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list |
| 56 | 54 |
apt-get update |
| ... | ... |
@@ -78,15 +68,14 @@ role. |
| 78 | 78 |
|
| 79 | 79 |
Adjust PostgreSQL configuration so that remote connections to the |
| 80 | 80 |
database are possible. Make sure that inside |
| 81 |
-``/etc/postgresql/9.3/main/pg_hba.conf`` you have following line (you will need |
|
| 82 |
-to install an editor, e.g. ``apt-get install vim``): |
|
| 81 |
+``/etc/postgresql/9.3/main/pg_hba.conf`` you have following line: |
|
| 83 | 82 |
|
| 84 | 83 |
.. code-block:: bash |
| 85 | 84 |
|
| 86 | 85 |
host all all 0.0.0.0/0 md5 |
| 87 | 86 |
|
| 88 | 87 |
Additionaly, inside ``/etc/postgresql/9.3/main/postgresql.conf`` |
| 89 |
-uncomment ``listen_addresses`` so it is as follows: |
|
| 88 |
+uncomment ``listen_addresses`` like so: |
|
| 90 | 89 |
|
| 91 | 90 |
.. code-block:: bash |
| 92 | 91 |
|
| ... | ... |
@@ -104,14 +93,14 @@ Exit. |
| 104 | 104 |
|
| 105 | 105 |
exit |
| 106 | 106 |
|
| 107 |
-Create an image and assign it a name. ``<container_id>`` is in the |
|
| 108 |
-Bash prompt; you can also locate it using ``docker ps -a``. |
|
| 107 |
+Create an image from our container and assign it a name. The ``<container_id>`` |
|
| 108 |
+is in the Bash prompt; you can also locate it using ``docker ps -a``. |
|
| 109 | 109 |
|
| 110 | 110 |
.. code-block:: bash |
| 111 | 111 |
|
| 112 | 112 |
sudo docker commit <container_id> <your username>/postgresql |
| 113 | 113 |
|
| 114 |
-Finally, run PostgreSQL server via ``docker``. |
|
| 114 |
+Finally, run the PostgreSQL server via ``docker``. |
|
| 115 | 115 |
|
| 116 | 116 |
.. code-block:: bash |
| 117 | 117 |
|
| ... | ... |
@@ -121,9 +110,9 @@ Finally, run PostgreSQL server via ``docker``. |
| 121 | 121 |
-D /var/lib/postgresql/9.3/main \ |
| 122 | 122 |
-c config_file=/etc/postgresql/9.3/main/postgresql.conf') |
| 123 | 123 |
|
| 124 |
-Connect the PostgreSQL server using ``psql`` (You will need the postgresql client installed |
|
| 125 |
-on the machine. For ubuntu, use something like |
|
| 126 |
-``sudo apt-get install postgresql-client``). |
|
| 124 |
+Connect the PostgreSQL server using ``psql`` (You will need the |
|
| 125 |
+postgresql client installed on the machine. For ubuntu, use something |
|
| 126 |
+like ``sudo apt-get install postgresql-client``). |
|
| 127 | 127 |
|
| 128 | 128 |
.. code-block:: bash |
| 129 | 129 |
|
| ... | ... |
@@ -140,7 +129,7 @@ As before, create roles or databases if needed. |
| 140 | 140 |
docker=# CREATE DATABASE foo OWNER=docker; |
| 141 | 141 |
CREATE DATABASE |
| 142 | 142 |
|
| 143 |
-Additionally, publish your newly created image on Docker Index. |
|
| 143 |
+Additionally, publish your newly created image on the Docker Index. |
|
| 144 | 144 |
|
| 145 | 145 |
.. code-block:: bash |
| 146 | 146 |
|