Set container name in run/debug configuration



I am trying to set the name of the container that is going to spawn via the docker run/debug execution. I think everything else works fine but the spawned container is with a random name and I need it to show with a specific one. If I understand the flow correctly, I must build a docker images first, then create a "remote interpreter" configuration that uses that docker image and set it as the project interpreter. Now when I create a pyramid run/debug configuration, Pycharm knows that it should spawn a container but it does so with a random name.


Can I achieve this in some way?






There are number of settings in Python Run/Debug configuration you may setup running Python applications using Docker interpreter. Please take a look for Docker container settings at this help page. However there are no options for setting container name. Please vote and follow this issue.


Thank you Alexander,

Thank you for the response. At least I know I am not missing something. I've put a vote for the linked issue.

For anyone else wondering, a dirty workaround is renaming the container after it is spawned with docker rename <current_name> <new_name> .



There is an option with docker compose. Use de COMPOSE_PROJECT_NAME cli variable with you projects name and then pycharm create the container with projectname + docker compose server.

Settings =< project => project interpreter. Create a new one and use docker compose as your interpreter. Then select your docker compose file, service and use COMPOSE_PROJECT_NAME as environment variable. Done



Please sign in to leave a comment.