1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #2160 from iffy/patch-1

Minor updates to postgresql_service.rst
This commit is contained in:
Andy Rothfusz 2013-10-14 11:59:57 -07:00
commit 93b258413f

View file

@ -43,8 +43,8 @@ Install ``python-software-properties``.
.. code-block:: bash .. code-block:: bash
apt-get install python-software-properties apt-get -y install python-software-properties
apt-get install software-properties-common apt-get -y install software-properties-common
Add Pitti's PostgreSQL repository. It contains the most recent stable release Add Pitti's PostgreSQL repository. It contains the most recent stable release
of PostgreSQL i.e. ``9.2``. of PostgreSQL i.e. ``9.2``.
@ -77,7 +77,8 @@ role.
Adjust PostgreSQL configuration so that remote connections to the Adjust PostgreSQL configuration so that remote connections to the
database are possible. Make sure that inside database are possible. Make sure that inside
``/etc/postgresql/9.2/main/pg_hba.conf`` you have following line: ``/etc/postgresql/9.2/main/pg_hba.conf`` you have following line (you will need
to install an editor, e.g. ``apt-get install vim``):
.. code-block:: bash .. code-block:: bash
@ -90,9 +91,17 @@ uncomment ``listen_addresses`` so it is as follows:
listen_addresses='*' listen_addresses='*'
*Note:* this PostgreSQL setup is for development only purposes. Refer .. note::
to PostgreSQL documentation how to fine-tune these settings so that it
is enough secure. This PostgreSQL setup is for development only purposes. Refer
to PostgreSQL documentation how to fine-tune these settings so that it
is enough secure.
Exit.
.. code-block:: bash
exit
Create an image and assign it a name. ``<container_id>`` is in the Create an image and assign it a name. ``<container_id>`` is in the
Bash prompt; you can also locate it using ``docker ps -a``. Bash prompt; you can also locate it using ``docker ps -a``.
@ -111,7 +120,9 @@ Finally, run PostgreSQL server via ``docker``.
-D /var/lib/postgresql/9.2/main \ -D /var/lib/postgresql/9.2/main \
-c config_file=/etc/postgresql/9.2/main/postgresql.conf') -c config_file=/etc/postgresql/9.2/main/postgresql.conf')
Connect the PostgreSQL server using ``psql``. Connect the PostgreSQL server using ``psql`` (You will need postgres installed
on the machine. For ubuntu, use something like
``sudo apt-get install postgresql``).
.. code-block:: bash .. code-block:: bash
@ -128,7 +139,7 @@ As before, create roles or databases if needed.
docker=# CREATE DATABASE foo OWNER=docker; docker=# CREATE DATABASE foo OWNER=docker;
CREATE DATABASE CREATE DATABASE
Additionally, publish there your newly created image on Docker Index. Additionally, publish your newly created image on Docker Index.
.. code-block:: bash .. code-block:: bash
@ -149,10 +160,11 @@ container starts.
.. code-block:: bash .. code-block:: bash
sudo docker commit <container_id> <your username> postgresql -run='{"Cmd": \ sudo docker commit -run='{"Cmd": \
["/bin/su", "postgres", "-c", "/usr/lib/postgresql/9.2/bin/postgres -D \ ["/bin/su", "postgres", "-c", "/usr/lib/postgresql/9.2/bin/postgres -D \
/var/lib/postgresql/9.2/main -c \ /var/lib/postgresql/9.2/main -c \
config_file=/etc/postgresql/9.2/main/postgresql.conf"], "PortSpecs": ["5432"]}' config_file=/etc/postgresql/9.2/main/postgresql.conf"], "PortSpecs": ["5432"]}' \
<container_id> <your username>/postgresql
From now on, just type ``docker run <your username>/postgresql`` and From now on, just type ``docker run <your username>/postgresql`` and
PostgreSQL should automatically start. PostgreSQL should automatically start.