Docker volume doesn't keep data after turned docker-compose down
问题 I am using docker compose to combine 2 images (tomcat with my app and database - postgres). My compose file looks like this : version: '3' services: tomcat: build: ./tomcat-img ports: - "8080:8080" depends_on: - "db" db: build: ./db-img volumes: - db-data:/var/lib/postgres/data ports: - "5433:5432" volumes: db-data: and here is dockerfile for database image: FROM postgres:9.5-alpine ENV POSTGRES_DB mydb ENV POSTGRES_USER xxxx ENV POSTGRES_PASSWORD xxxx COPY init-db.sql /docker-entrypoint