I've added the steps that were missing/wrong for me when I went through this just now.
| ... | ... |
@@ -43,8 +43,8 @@ Install ``python-software-properies``. |
| 43 | 43 |
|
| 44 | 44 |
.. code-block:: bash |
| 45 | 45 |
|
| 46 |
- apt-get install python-software-properties |
|
| 47 |
- apt-get install software-properties-common |
|
| 46 |
+ apt-get -y install python-software-properties |
|
| 47 |
+ apt-get -y install software-properties-common |
|
| 48 | 48 |
|
| 49 | 49 |
Add Pitti's PostgreSQL repository. It contains the most recent stable release |
| 50 | 50 |
of PostgreSQL i.e. ``9.2``. |
| ... | ... |
@@ -77,7 +77,8 @@ role. |
| 77 | 77 |
|
| 78 | 78 |
Adjust PostgreSQL configuration so that remote connections to the |
| 79 | 79 |
database are possible. Make sure that inside |
| 80 |
-``/etc/postgresql/9.2/main/pg_hba.conf`` you have following line: |
|
| 80 |
+``/etc/postgresql/9.2/main/pg_hba.conf`` you have following line (you will need |
|
| 81 |
+to install an editor, e.g. ``apt-get install vim``): |
|
| 81 | 82 |
|
| 82 | 83 |
.. code-block:: bash |
| 83 | 84 |
|
| ... | ... |
@@ -90,9 +91,17 @@ uncomment ``listen_addresses`` so it is as follows: |
| 90 | 90 |
|
| 91 | 91 |
listen_addresses='*' |
| 92 | 92 |
|
| 93 |
-*Note:* this PostgreSQL setup is for development only purposes. Refer |
|
| 94 |
-to PostgreSQL documentation how to fine-tune these settings so that it |
|
| 95 |
-is enough secure. |
|
| 93 |
+.. note:: |
|
| 94 |
+ |
|
| 95 |
+ This PostgreSQL setup is for development only purposes. Refer |
|
| 96 |
+ to PostgreSQL documentation how to fine-tune these settings so that it |
|
| 97 |
+ is enough secure. |
|
| 98 |
+ |
|
| 99 |
+Exit. |
|
| 100 |
+ |
|
| 101 |
+.. code-block:: bash |
|
| 102 |
+ |
|
| 103 |
+ exit |
|
| 96 | 104 |
|
| 97 | 105 |
Create an image and assign it a name. ``<container_id>`` is in the |
| 98 | 106 |
Bash prompt; you can also locate it using ``docker ps -a``. |
| ... | ... |
@@ -111,7 +120,9 @@ Finally, run PostgreSQL server via ``docker``. |
| 111 | 111 |
-D /var/lib/postgresql/9.2/main \ |
| 112 | 112 |
-c config_file=/etc/postgresql/9.2/main/postgresql.conf') |
| 113 | 113 |
|
| 114 |
-Connect the PostgreSQL server using ``psql``. |
|
| 114 |
+Connect the PostgreSQL server using ``psql`` (You will need postgres installed |
|
| 115 |
+on the machine. For ubuntu, use something like |
|
| 116 |
+``sudo apt-get install postgresql``). |
|
| 115 | 117 |
|
| 116 | 118 |
.. code-block:: bash |
| 117 | 119 |
|
| ... | ... |
@@ -128,7 +139,7 @@ As before, create roles or databases if needed. |
| 128 | 128 |
docker=# CREATE DATABASE foo OWNER=docker; |
| 129 | 129 |
CREATE DATABASE |
| 130 | 130 |
|
| 131 |
-Additionally, publish there your newly created image on Docker Index. |
|
| 131 |
+Additionally, publish your newly created image on Docker Index. |
|
| 132 | 132 |
|
| 133 | 133 |
.. code-block:: bash |
| 134 | 134 |
|
| ... | ... |
@@ -149,10 +160,11 @@ container starts. |
| 149 | 149 |
|
| 150 | 150 |
.. code-block:: bash |
| 151 | 151 |
|
| 152 |
- sudo docker commit <container_id> <your username> postgresql -run='{"Cmd": \
|
|
| 152 |
+ sudo docker commit -run='{"Cmd": \
|
|
| 153 | 153 |
["/bin/su", "postgres", "-c", "/usr/lib/postgresql/9.2/bin/postgres -D \ |
| 154 | 154 |
/var/lib/postgresql/9.2/main -c \ |
| 155 |
- config_file=/etc/postgresql/9.2/main/postgresql.conf"], "PortSpecs": ["5432"]}' |
|
| 155 |
+ config_file=/etc/postgresql/9.2/main/postgresql.conf"], "PortSpecs": ["5432"]}' \ |
|
| 156 |
+ <container_id> <your username>/postgresql |
|
| 156 | 157 |
|
| 157 | 158 |
From now on, just type ``docker run <your username>/postgresql`` and |
| 158 | 159 |
PostgreSQL should automatically start. |