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
• 6,900 points
46 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,620 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 19, 2018 in Docker by Tyrion anex
• 8,280 points
29 views
+1 vote
11 answers

How to run multiple commands in docker at once?

Try this: docker run image bash -c "cd ...READ MORE

answered Apr 17 in Docker by anonymous

edited Apr 17 by Kalgi 8,342 views
0 votes
1 answer

How to list containers in Docker

To show only running containers use the given command: docker ...READ MORE

answered Jul 20, 2018 in Docker by Kalgi
• 35,800 points
20 views
0 votes
1 answer
0 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
• 56,120 points
60 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,620 points
39 views
0 votes
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,620 points
21 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.