I am using a docker-compose.yml file to build 3 docker containers for my django nginx postgresql and a pure data container.
Here is my docker-compose.yml
data:
# pure data container
image: busybox
volumes:
- /etc/postgresql
- /var/log/postgresql:/var/log/postgresql
- /var/lib/postgresql
- /var/log/nginx:/var/log/nginx
- /var/log/supervisor:/var/log/supervisor
db:
image: postgres
volumes_from:
- data
web:
build: .
ports:
- "80:80"
- "443:443"
links:
- db
volumes_from:
- data
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cc26b3a72a02 myweb_web:latest "supervisord -n" 6 minutes ago Up 6 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp myweb_web_1
14763a9f68d1 postgres:latest "/docker-entrypoint. 6 minutes ago Up 6 minutes 5432/tcp myweb_db_1
37598892038b busybox:latest "/bin/sh" 6 minutes ago Exited (0) 6 minutes ago myweb_data_1
I have concerns on how to backup and restore the postgresql data stored in the pure data container(myweb_data_1). I use "docker-compose build && docker-compose up" command to rebuild docker images and restart containers if I update the codes, but not sure if this is right or best way to do it.