Volumes
Synpse can mount volumes from the host. Volumes can be used to share data between the containers or persist data so it survives container restart.
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure and OS of the host machine, volumes are completely managed by Docker.
Volumes are defines as part of your application specification, where
/tmp/redis
is host location and /data
is inside the container.name: redis
description: Redis example
type: container
scheduling:
type: AllDevices
spec:
containers:
- name: redis
image: docker.io/redis:latest
networkMode: host
volumes:
- /tmp/redis:/data
Many applications rely on certain files to be up-to-date from the host machine. You can mount them directly to the container:
name: homeassistant
description: Homeassistant master
scheduling:
type: Conditional
selectors:
homeassistant: master
spec:
containers:
- name: homeassistant
image: docker.io/homeassistant/raspberrypi4-homeassistant:stable
networkMode: host
volumes:
- /usr/homeassistant:/config
- /etc/localtime:/etc/localtime
Last modified 2yr ago