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

后端 未结 4 755
情话喂你
情话喂你 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条回答
  •  Happy的楠姐
    2021-02-05 02:26

    Docker compose will use the name of the directory with your compose file as the name of the project unless you set if via the -p option

    -p, --project-name NAME     Specify an alternate project name (default: directory name)
    

    Compose supports declaring default environment variables in an environment file named .env placed in the folder where the docker-compose command is executed (current working directory).

    Where you'll want to set COMPOSE_PROJECT_NAME

提交回复
热议问题