Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Docker compose: mount single file as a volume

This doesn't always work for me, but it's worth trying. To get a single file mounted inside a docker container as a volume, you have to use the long syntax.

version: "3.7"    
services:
app:
image: app:latest
volumes:
  - type: bind
    source: ./sourceFile.yaml
    target: /location/targetFile.yaml

References

Ripped directly from docker - How to mount a single file in a volume - Stack Overflow

Comments