the official Postgres image cannot save it's state in an image, because /var/lib/postgresql/data is overwritten every time the container runs.
In this image ENV: PGDATA uses the path /var/lib/postgresql-static/data. This means that the data in the database is saved every time when the container is commited.
RUN mkdir -p /var/lib/postgresql-static/data
ENV PGDATA /var/lib/postgresql-static/data