Skip to content

Set COMPOSE_PROJECT_NAME when invoking docker-compose #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

benjaoming
Copy link
Contributor

@benjaoming
Copy link
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
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
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
Member

humitos commented Jun 14, 2022

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

@benjaoming
Copy link
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