1

I'm running a containerized Milvus Standalone database (Milvus) and I'm trying to find the location of items added to the database. In the docker-compose.yml file, the volume location is defined as follows:

    volumes:
      - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd

Checking my docker server, I do not find an environment variable named DOCKER_VOLUME_DIRECTORY. What does this definition mean? Also, what does the

:-.

part mean?

1 Answers1

1

It is using Shell Parameter expansion:

${parameter:-word}

If parameter is unset or null, then word is used as a default value.

In this case, as DOCKER_VOLUME_DIRECTORY is not set, the default value of . (the current directory) is used.

$ echo ${DOCKER_VOLUME_DIRECTORY:-.}
.

So the volume will effectively be:

volumes:
  - ./volumes/etcd:/etcd
codemonkey
  • 3,510
  • 3
  • 23
  • 35
  • 1
    Note that Compose only [supports](https://docs.docker.com/compose/compose-file/compose-file-v3/#variable-substitution) a limited set of shell parameter expansions. So `${VARIABLE:-default}` works, but not _e.g._ `${VARIABLE+alternative value}`. – David Maze Jan 06 '23 at 14:23