-1

Dont know if its a Docker problem or a Postgres problem...

I have installed a Postgres container, installed Bitbucket container, and linked the two together. Can connect just fine.

After that I installed Jira. And a Jira database. Both running fine. Then I disconnected the Postgres server, and connected again. Then my Bitbucket DB was gone? Its just like I automatically dropped the database?

Anyone have a clue what happened?

Regards J.

  • What docker image are you using? You might need to set the VOLUME parameter in your docker command and then mount it to a local path on your computer. – Alex Plugaru Aug 31 '18 at 0:54
  • Im using the official postgres Docker image – Jakobbbb Aug 31 '18 at 3:06
0

If you are using the official docker postgres image then make sure that you are using a docker volume to save your data in the path defined by PGDATA env variable. For example, if you are using docker-compose you can define a service like this:

  pg:
    image: postgres
    ports:
    - "127.0.0.1:5432:5432"
    volumes:
    - ./you-local-machine-path/pg-data:/var/lib/postgresql/data

Note that /var/lib/postgresql/data is the path inside your docker container.

Docker uses volumes to persist data, once the container stops you are losing all the data that you write in it if you don't use volumes - that is why it's important to use volumes for applications that have a state.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.