Browse Source

Add postgres docs for environment variables

Joe Ferguson 11 years ago
parent
commit
fbf180f4d6
2 changed files with 42 additions and 2 deletions
  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
 ## 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
 This image includes `EXPOSE 5432` (the postgres port), so standard container
 linking will make it automatically available to the linked containers. The
 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'
     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
 # How to extend this image
 
 
 If you would like to do additional initialization in an image derived from this
 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
 ## 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
 This image includes `EXPOSE 5432` (the postgres port), so standard container
 linking will make it automatically available to the linked containers. The
 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'
     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
 # How to extend this image
 
 
 If you would like to do additional initialization in an image derived from this
 If you would like to do additional initialization in an image derived from this