Skip to content

Instantly share code, notes, and snippets.

@eenchev
Last active February 26, 2020 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eenchev/f174bb94adb3d07520225fc6ea55da75 to your computer and use it in GitHub Desktop.
Save eenchev/f174bb94adb3d07520225fc6ea55da75 to your computer and use it in GitHub Desktop.
Run Postgresql in Docker with persistent data

Create a volume:

docker volume create VOLUME_NAME_PLACEHOLDER

Run the container, using that volume

docker run --name CONTAINER_NAME_PLACEHOLDER -it --rm \
            -e POSTGRES_PASSWORD=POSTGRES_USER_PASSWORD_PLACEHOLDER -p 5444:5432 \
            -v VOLUME_NAME_PLACEHOLDER:/var/lib/postgresql/data -d postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment