News for hackers. Stuff that matters.
Re:Docker Compose syntax: Volume or Bind mount? by maximization on Thursday April 02, 2020 @02:38PM (#22762144)
Compose allows you to configure volumes using a short syntax format: `[SOURCE:]TARGET[:MODE]`

In practice, this leads to different string variations. Every time I read a docker-compose.yml file, I had to refer to the docs or run a quick test to figure out if a volume or a bind mount is used. I wrote a short guide so I wouldn't have to look this stuff up anymore and be able to memorise it by heart.

The gist of it is:

1. No source -> anonymous volume

2. Non-path source -> named volume (defined in a top-level `volumes` key)

3. Relative or absolute path source -> bind mount

Hope this helps some of you out there that trip over this syntax like me.

Stay home and be safe!

There are no comments on this comment yet.