Mounts a host file as read-only in the container.
Section: Volumes and Storage
Read-only bind mount
yaml
yaml
services:
nginx:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:roExplanation
Good for config files that should not be modified in-place.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Volumes and Storage
Named volume for persistent data
Stores database data in a managed named volume.
Use tmpfs mount
Creates an in-memory temporary filesystem for the service.
Remove stack and its volumes
Tears down the project and deletes named volumes created for it.