Skip to content
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

Deleting an image built by docker-compose results in "No such image" error on next run #1113

toli opened this issue Mar 13, 2015 · 17 comments


Copy link

@toli toli commented Mar 13, 2015

Creating an image with docker-compose up and shutting it down and subsequently deleting the underlying image results in next docker-compose up command erroring out with "No such image" error.

Steps to reproduce:

  • checkout, it's a Docker Compose setup with some bins and 2 underlying dependencies
  • run it with docker-compose up
  • Stop it
  • Remove the top-level built image with docker rm -f metcdocker_metc
  • Run docker-compose up again
    You will see the error:
metc-docker> docker-compose up
Recreating metcdocker_mysql_1...
Recreating metcdocker_metc_1...
No such image: 19b5e447fe00 (tag: latest)

The referenced image was the first of deleted images:

toli@toli-docker:~/dev/marketcetera/metc-docker> docker rmi -f 19b5e447fe00
Untagged: metcdocker_metc:latest
Deleted: 19b5e447fe007b86dba74fd35b03d2ca4e12afbbad509274476ff907e7f96499
toli:~/metc-docker> docker-compose up
Recreating metcdocker_mysql_1...
Recreating metcdocker_metc_1...
No such image: 19b5e447fe00 (tag: latest)

And the way to fix it is to run docker ps -a and delete the reference to the container that used that image

toli@toli:~/metc-docker> docker ps -a
CONTAINER ID        IMAGE                                COMMAND                CREATED             STATUS                        PORTS                    NAMES
154b0e044fc4        19b5e447fe00                         "/bin/sh -c ./start-   19 minutes ago      Exited (137) 18 minutes ago                            metcdocker_metc_1

toli@toli:~/metc-docker>docker rm 154b0e044fc4

Even though the container has exited, it still seems to be referencing deleted image.
Running docker-container up again works after deleting the already-deleted image.

Copy link

@dnephin dnephin commented Mar 13, 2015

This will be fixed by #874, the image is only used for the intermediate

Copy link

@dnephin dnephin commented Apr 24, 2015

Going to close this issue, please follow along in #874 for the fix

@dnephin dnephin closed this Apr 24, 2015
Copy link

@justechn justechn commented Feb 18, 2016

I am still running into this issue
I am using Docker version 1.9.1, build a34a1d5

I had to run docker-compose rm and then docker-compose up before it would work correctly

Copy link

@AvdN AvdN commented Feb 24, 2016

I ran into this issue as well @justechn suggestion worked for me as well.

Copy link

@rongduan-zhu rongduan-zhu commented Feb 26, 2016

Same, I am running into the same issue.

Docker version: 1.10.0, build 590d5108
Docker compose version: 1.6.0, build d99cad6

And running docker-compose rm then docker-compose up fixes the issue as @justechn suggested.

Copy link

@timsuchanek timsuchanek commented Mar 10, 2016

Same here.
Docker version 1.10.2, build c3959b1
docker-compose version 1.6.0, build d99cad6

It happend after I did docker rmi on all images, because the "no space left on device" error appeared:

Copy link

@dnephin dnephin commented Mar 10, 2016

Deleting all images is a bad idea. If you need to recover from this state you should be able to docker-compose rm to remove the containers which expect the image to exist. However note that you will lose any data volumes by doing this.

Instead of removing all images, I would suggest using something like to remove the oldest unused images (and containers).

Copy link

@rpicheta rpicheta commented Aug 10, 2016

Run docker-compose stop and thendocker-composer rm xyz

# Example
$ docker-compose rm nginx
# From docker-compose.yml file
# xyz:
#  image: nginx:latest
Copy link

@TetianaPozniakova TetianaPozniakova commented Sep 9, 2016

Removed old image and encountered the same issue today. Removing all containers helped.

Copy link

@pyros2097 pyros2097 commented Oct 14, 2016

Just ran into this issue. I had not space on my system so decided to remove all the images forcefully.

Copy link

@kozzztik kozzztik commented Oct 17, 2016

Same problem
ERROR: for ### b'No such image: sha256:6e3ba2ac39dbca779294b29cb7e70dbca9b7346a8072e57eb9c67dec9410857f'

Copy link

@mishu- mishu- commented Oct 18, 2016

Got the same problem. Removed all images and some of them throw this error when doing docker-compose up again.

Copy link

@GrigoriyDidorenko GrigoriyDidorenko commented Oct 27, 2016

As it was said before, you could use docker-compose rm and then use docker-compose up again.

Copy link

@dkdndes dkdndes commented Aug 26, 2017

Feature request:

Provide a command which removes old unused images.


Right now I need to use the above statement which is not standard documentation and need to read that used "docker rmi" is a bad idea (see above).

I believe it's not good to have a backlog of images which never will be used again. I use Docker 17.07 and run into this problem again.

Copy link

@cosmocracy cosmocracy commented Sep 22, 2017

Wasted an hour on this issue (using most recent docker-compose version 1.16.1, build 6d1ac21) and was hoping the tool would better handle this situation/issue from two years ago.

Copy link

@alexbenfica alexbenfica commented Nov 14, 2017

Still evaluating PyCharm... same issue :(
Docker version 17.04.0-ce, build 4845c56
PyCharm 2017.2.4
Build #PY-172.4343.24, built on October 19, 2017
Licensed to PyCharm Evaluator
Expiration date: December 10, 2017
JRE: 1.8.0_152-release-915-b12 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-98-generic

Copy link

@dmalaescu dmalaescu commented Jan 11, 2018

Same issues here, removing all the images and then starting docker-compose up results into the same error:

ERROR: for zookeeper b'no such image: sha256:7d8fb327b1f68c58da35fb0b8094ef003437c477371f0051ed0d98d17e5294bd: No such image: sha256:7d8fb327b1f68c58da35fb0b8094ef003437c477371f0051ed0d98d17e5294bd'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.