What You'll Learn
Beginner
- How to define volumes in Compose
- How to define custom networks
docker-compose.ymlyaml
services:
db:
image: postgres:15
volumes:
- db-data:/var/lib/postgresql/data
web:
image: nginx
volumes:
- ./html:/usr/share/nginx/html:ro
networks: [frontend]
volumes:
db-data:
networks:
frontend:Key Takeaways
- Named volumes: declare under
volumes:. - Bind mounts:
./host:/containerwith:ro. - Compose creates a default network automatically.
- Custom networks: declare under
networks:.
Comments
Comments
Post a Comment