It is not obvious from salt documentation on salt.states.docker_container how to attach named volume to a container. Named volumes are not mentioned at all. In fact it is possible to use binds: list under salt.states.docker_container.running to do it.
Example: It will create named volume test_volume and bind it to /home, unnamed volume will be mounted to /mnt and tmpfs will be mounted to /var/run
Create docker volume:
docker_volume.present:
- name: test_volume
- driver: local
Start container:
docker_container.running:
- name: hello-world
- image: hello-world:latest
- hostname: hello-world
- read_only: true
- volumes:
- /tmp
- binds:
- test_volume:/home
- tmpfs:
- /var/run: rw,noexec,nosuid,size=65536k