How to store data in external drive with Docker Postgres 9 3 image

0 votes

I want to setup my database inside a container using the Postgres:9.3 docker image, however I want to store my data in external drive.

I attempted it using the command

`docker run -dit -p 5432:5432 -v /mnt/external/docker_volume:/var/lib/postgresql/data --name mydatabase postgres:9.3`

Container got created as it echoes the container id, but it is not shown as running from docker ps. The above command works for other images. The images has VOLUME defined in its dockerfile but I haven't figure out a way to get around it.  Can somebody help me?

Jul 12, 2018 in Docker by Nilesh
• 7,050 points
2,332 views

1 answer to this question.

0 votes
Apparently, the problem would be in your  /mnt/external/docker_volume. It was not empty and the Postgres init script didn't like it. Found this out after running with -it option and saw the output in terminal.
answered Jul 12, 2018 by Kalgi
• 2,680 points

Related Questions In Docker

0 votes
1 answer
0 votes
1 answer

How to run an image with volume on docker for windows?

Try : declaring the volume of container mounting the ...READ MORE

answered Sep 20, 2018 in Docker by Tyrion anex
• 8,700 points
621 views
0 votes
1 answer

How to Backup, Restore or Migrate data volumes in a docker container?

Steps to Backup a container 1)     ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,230 points
13,753 views
+2 votes
1 answer

How to link one running container with other running container in docker.

Hi @Yuvraj! Yes, this is possible. You can ...READ MORE

answered Dec 16, 2019 in Docker by Kalgi
• 52,360 points
1,716 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,090 points
2,436 views
0 votes
1 answer

How to deal with persistent storage (e.g. databases) in docker

For Docker 1.9.0 and above, Use volume API docker ...READ MORE

answered Jul 18, 2018 in Docker by Kalgi
• 2,680 points
576 views
+1 vote
1 answer

How to remove old Docker containers

There is a new feature in Docker 1.13.x called Docker ...READ MORE

answered Jul 18, 2018 in Docker by Kalgi
• 2,680 points
504 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP