After I delete the volume of the db service by running docker volume rm <volume_name>, the database is not recreated when I am rebuilding the container by docker-compose up -d --build. What is the reason ? My docker-compose file looks like this:
version: "2"
services:
db:
image: 'postgres:latest'
ports:
- "5432:5432"
env_file:
- .env
volumes:
- db:/var/lib/postgresql/data:rw
restart: "always"
volumes:
db: {}