Przeglądaj źródła

Merge pull request #105 from infosiftr/postgres

Add postgres docs for environment variables
Tianon Gravi 11 lat temu
rodzic
commit
b682b6f609
2 zmienionych plików z 42 dodań i 2 usunięć
  1. 21 1
      postgres/README.md
  2. 21 1
      postgres/content.md

+ 21 - 1
postgres/README.md

@@ -47,7 +47,7 @@ Oracle.
 
 ## start a postgres instance
 
-    docker run --name some-postgres -d postgres
+    docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
 
 This image includes `EXPOSE 5432` (the postgres port), so standard container
 linking will make it automatically available to the linked containers. The
@@ -65,6 +65,26 @@ default `postgres` user and database are created in the entrypoint with
 
     docker run -it --link some-postgres:postgres --rm postgres sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres'
 
+## Environment Variables
+
+The PostgreSQL image uses several environment variables which are easy to miss.
+While none of the variables are required, they may significantly aid you in
+using the image.
+
+### `POSTGRES_PASSWORD`
+
+This environment variable is recommend for you to use the PostgreSQL image. This
+environment variable sets the superuser password for PostgreSQL. The default
+superuser is defined by the `POSTGRES_USER` environment variable. In the above
+example, it is being set to "mysecretpassword".
+
+### `POSTGRES_USER`
+
+This optional environment variable is used in conjunction with
+`POSTGRES_PASSWORD` to set a user and its password. This varible will create the
+specified user with superuser power and a database with the same name. If it is
+not specified, then the default user of `postgres` will be used.
+
 # How to extend this image
 
 If you would like to do additional initialization in an image derived from this

+ 21 - 1
postgres/content.md

@@ -32,7 +32,7 @@ Oracle.
 
 ## start a postgres instance
 
-    docker run --name some-postgres -d postgres
+    docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
 
 This image includes `EXPOSE 5432` (the postgres port), so standard container
 linking will make it automatically available to the linked containers. The
@@ -50,6 +50,26 @@ default `postgres` user and database are created in the entrypoint with
 
     docker run -it --link some-postgres:postgres --rm postgres sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres'
 
+## Environment Variables
+
+The PostgreSQL image uses several environment variables which are easy to miss.
+While none of the variables are required, they may significantly aid you in
+using the image.
+
+### `POSTGRES_PASSWORD`
+
+This environment variable is recommend for you to use the PostgreSQL image. This
+environment variable sets the superuser password for PostgreSQL. The default
+superuser is defined by the `POSTGRES_USER` environment variable. In the above
+example, it is being set to "mysecretpassword".
+
+### `POSTGRES_USER`
+
+This optional environment variable is used in conjunction with
+`POSTGRES_PASSWORD` to set a user and its password. This varible will create the
+specified user with superuser power and a database with the same name. If it is
+not specified, then the default user of `postgres` will be used.
+
 # How to extend this image
 
 If you would like to do additional initialization in an image derived from this