Skip to content

Set COMPOSE_PROJECT_NAME when invoking docker-compose#145

Closed
benjaoming wants to merge 1 commit intoreadthedocs:mainfrom
benjaoming:fix-COMPOSE_PROJECT_NAME
Closed

Set COMPOSE_PROJECT_NAME when invoking docker-compose#145
benjaoming wants to merge 1 commit intoreadthedocs:mainfrom
benjaoming:fix-COMPOSE_PROJECT_NAME

Conversation

@benjaoming
Copy link
Copy Markdown
Contributor

@benjaoming
Copy link
Copy Markdown
Contributor Author

Reminder to update readthedocs/readthedocs.org#9319 after this is merged

@benjaoming benjaoming force-pushed the fix-COMPOSE_PROJECT_NAME branch from dbeb789 to fe20078 Compare June 10, 2022 12:52
@benjaoming benjaoming mentioned this pull request Jun 10, 2022
Copy link
Copy Markdown
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented on readthedocs/readthedocs.org#9319 (comment) about how to solve this without introducing this change.

I prefer if we can read this automatically from the .env file so we can keep the current setup working together with corporate Docker instances.

@benjaoming
Copy link
Copy Markdown
Contributor Author

benjaoming commented Jun 14, 2022

Re:

I prefer if we can read this automatically from the .env file so we can keep the current setup working together with corporate Docker instances.

I'll make a check to see if/how this works, but did you notice that the patch does not propose to overwrite existing env variables?

DOCKER_COMPOSE_PROJECT_NAME = os.environ.get('COMPOSE_PROJECT_NAME', 'community')

@humitos
Copy link
Copy Markdown
Member

humitos commented Jun 14, 2022

Yes. It seems this PR is not required anymore now that #148 got merged.

@benjaoming
Copy link
Copy Markdown
Contributor Author

benjaoming commented Jun 14, 2022

Agreed - the .env file does not trump existing environment variables so this PR can never wort together with a .env 👍

I found a segment in the Compose docs that specifices that .env can be used both for container instance variables and any other configuration, so I suppose it means that COMPOSE_PROJECT_NAME is supposed to be an intentional part of .env (I previously read the docs as if it was not intended for comfiguring Compose itself).

The “.env” file

You can set default values for any environment variables referenced in the Compose file, or used to configure Compose, in an environment file named .env. The .env file path is as follows:

@benjaoming benjaoming closed this Jun 14, 2022
@benjaoming benjaoming deleted the fix-COMPOSE_PROJECT_NAME branch June 14, 2022 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COMPOSE_PROJECT_NAME should not be required for development setup

2 participants