docker-compose image named: “prefix_%s_1” instead of “%s”

后端 未结 4 709
情话喂你
情话喂你 2021-02-05 01:29

When I set up a couple of Docker containers in docker-compose.yaml file with links, the name of the containers ends up being of the format prefix_%s_1

4条回答
  •  感情败类
    2021-02-05 02:26

    According to docker compose issue #745:

    By default, Compose bases the project name on basename of the directory compose commands are run from. The project name can be overridden either by passing a -p / --project-name option for each command or setting the COMPOSE_PROJECT_NAME environment variable.

    You can set the prefix of your choice to your container names by writing something like this:

    $ docker-compose -p MY_PROJECT_NAME
    

    which is the equivalent to (the more readable):

    $ docker-compose --project-name MY_PROJECT_NAME
    

提交回复
热议问题