Search code examples
docker-composekeycloak

Double colon in docker-compose volumes?


I was looking over this Keycloak issue on Github and noticed that in the example this person gives of a docker-compose configuration for Keycloak, the volume has two colons:

keycloak:
  image: "quay.io/keycloak/keycloak:16.1.1"
  environment:
    - KEYCLOAK_IMPORT=/tmp/realm.json
  volumes:
    - ./realm.json:/tmp/realm.json:ro

Now I know what one colon does but I was looking on the docker compose documentation but I can't find an explanation for what two colons is supposed to do. So what does having two colons do?


Solution

  • The second colon allows you set certain options for the mount; this is documented in docker run manual. Your options are:

    • ro -- make the mount read-only
    • rw -- make the mount read-write (the default)
    • z, Z -- control selinux labels on the volume (see the docs for more info)