Configuring Service storage
Given the ephemeral nature of containers, it’s important to consider storage solutions to avoid data loss. We suggest mounting volumes from your container to the host.
Adding storage volumes
volumes directive of the
service.yml allows you to mount custom host folders inside your container. This is useful if you need to run a database service for instance, as data written to the local filesystem of your container will not be persisted between container instances.
The volumes option is expressed as a comma separated list with the following form:
You can optionally add
rw to specify that the container can read/write to the host folder (the default is read/write).
Paths must be absolute.
services: <service_name>: volumes: ["/tmp:/tmp_host", "/readonly/folder:/mnted_readony:ro"]