Docker-compose - ERROR: no container found after directory change

Viewed 1551

I use to work on my host on a given directory.

dev_3/
     docker-compose-dev.yml

and my docker-compose-dev.yml had a service called 'web' in it, whose container would be called 'web_1', when up'd.

web (service) ---> web_1 (container)

Then I changed my directory path, but keeping the same directory name, 'dev_3'.

When I rebuilt all my images from the same file, docker renamed containers to 'web_2', 'client_2' and so on.

But now If I run this command:

$ docker-compose -f docker-compose-dev.yml exec web python manage.py recreate_db 

I get the error:

ERROR: No container found for web_1

which does not exist anymore...so docker is still pointing to a ghost container.

how do i fix this?

1 Answers

I had to use brute force to solve the issue, with this command:

 docker container stop $(docker container ls -a -q) && docker system prune -a -f --volumes

And then all started working again, with new built images and fresh containers.

Related