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.

Overview

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.

Using volumes

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

Mounting files

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 updated