Dockertools: How docker compose project name is generated

Created on 16 Mar 2019  路  11Comments  路  Source: microsoft/DockerTools

Hello, I would like to know how this parameter (compose project name) is generated.

-p dockercompose12415008673026106123

Also, is it stored/configured some how?

Fixed - Pending Release

Most helpful comment

Hello. Any updates on this? I'd also like to be able to configure this value (and have it use the values specified in the docker-compose file).

All 11 comments

The project name is composed of two parts. In your example,
dockercompose : this is the file name without extension of the dcproj (the dash is removed--see below)
12415008673026106123: this is a non-cryptographic hash of the workspace directory; i.e. the location of the dcproj

The two are concatenated, and then non-alphanumeric characters (like the dash) are removed.

This value is not configurable.

Any plans to make it configurable?

Yes, we are actually working on that now for 16.4. By default we will be using the project name (sanitized for spaces/alphanumeric/etc.) as the container name, but you can override it by providing a container name in docker-compose.yml or docker-compose.override.yml.

It would be more convenient to be just able to specify explicitly what value should be passed to docker-compose -p argument. This is used as a prefix not just for container names, but also volumes and networks.

In my case, constant network name across multiple development machines is what I am after. For now I've ended up with external network which must be created manually (not an ideal solution).

Hello. Any updates on this? I'd also like to be able to configure this value (and have it use the values specified in the docker-compose file).

I've just discovered I can't have two stacks talking to each other (or indeed, a debug one talking to a non-debug one) using the automatic projectname-based network, which is a pain, as it means adding in hard-coded ones. Please consider a configurable property in the dcproj.

Would like to have docker-compose project name configurable. We are sharing the project between several developers and having the project have a different name on every developer's device does not allow us to write scripts properly. @bwateratmsft Not seeing this in 16.4 release, am I missing something?

Added this to our backlog and will look at making this configurable in 16.9

A fix for this issue has been implemented internally and would be available for download in 16.9.

@pratiksanglikar I just updated to Version 16.9.1 and added <DockerComposeUpArguments>-p MyProject</DockerComposeUpArguments> to the dcproj file. but it still generated -p myprojectdockercompose12449342703230600049 did this fix not make 16.9 or do you have an example on how to set the name correctly?

Hi @fuzzybair,
You can specify the project name using property - <DockerComposeProjectName>my-docker-compose-project</DockerComposeProjectName>.

Was this page helpful?
0 / 5 - 0 ratings