-1

I'm running an application under development with docker-compose.

I have a "web" service running a python Flask web application. This service depends on other ones (database, cache, ...).

I need to run the "web" main service interactively in order to get access to a debugger (ipdb). I found out that the way to do this would be

docker-compose run --name my-app.web --service-ports web

When I exit this container and try to run it again with the same command I got this error:

ERROR: Cannot create container for service web: Conflict. The container name "/my-app.web" is already in use by container "4fed84779bb02952dedb8493a65bd83b1a6664f066183233e8c8b4dc62291643". You have to remove (or rename) that container to be able to reuse that name.

How can I start again this container without creating a new one ?

Or is it the correct way to create new containers each time I need to start this application ?

Or did I miss something to be able to start one of the service interactively ?

1 Answer 1

2

As you're setting a custom name, docker-compose run doesn't remove the container once the execution is completed. To enable this behavior use the option --rm:

docker-compose run --rm --name my-app.web --service-ports web

You can also remove the container manually to be able to run it again:

docker rm my-app.web

This is not necessary if you don't set a custom name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.