docker compose group_add: allows the docker user to have secondary groups. This can be used to allow access to data that the docker user’s primary uid/gid cannot access. Rather than changing all the templates to ask for secondary GIDs, the existing group ID could allow a comma-separated list, eg.:
Group ID: 3010,3011,3012
would set primarily gid to 3010, and secondary gids 3011-3012.
Documentation reference: Services top-level elements | Docker Docs
group_add
group_add
specifies additional groups, by name or number, which the user inside the container must be a member of.
An example of where this is useful is when multiple containers (running as different users) need to all read or write the same file on a shared volume. That file can be owned by a group shared by all the containers, and specified in group_add
.
services:
myservice:
image: alpine
group_add:
- mail
Thank you,
Evan