Docker Compose: No such image

DockerDocker Compose

Docker Problem Overview


When I run docker-compose up, I get this error:

root@ubuntu:/home/benson/Docker/HaproxyMy# docker-compose up
Recreating 950ddc308278_950ddc308278_950ddc308278_950ddc308278_950ddc308278_haproxymy_webb_1
Recreating 485800bdf3a1_485800bdf3a1_485800bdf3a1_485800bdf3a1_485800bdf3a1_haproxymy_webc_1
Recreating 2b3338d88716_2b3338d88716_2b3338d88716_2b3338d88716_2b3338d88716_haproxymy_weba_1

ERROR: for webb  No such image: sha256:15853e771e7ca3f5eecee38fcf97efd3ee164c1b66e2ef543d9985a04e78e099

ERROR: for webc  No such image: sha256:15853e771e7ca3f5eecee38fcf97efd3ee164c1b66e2ef543d9985a04e78e099

ERROR: for weba  No such image: sha256:15853e771e7ca3f5eecee38fcf97efd3ee164c1b66e2ef543d9985a04e78e099

docker-compose.yml:

weba:
    build: ./web
    expose:
        - 80

webb:
    build: ./web
    expose:
        - 80

webc:
    build: ./web
    expose:
        - 80


haproxy:

    image: haproxy:latest
    
    volumes:

        - ./haproxy:/haproxy-override
        - ./haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
    links:

        - weba
        - webb
        - webc
    ports:

        - "80:80"
        - "70:70"
    expose:

        - "80"
        - "70"

Docker Solutions


Solution 1 - Docker

The old cache caused this issue, I failed to run this command the first time and docker-compose already created images which I can't see from docker images.

Need to check from docker-compose ps, and remove all old images with this command docker-compose rm, then rebuild again.

Solution 2 - Docker

I encountered this error when using Docker Machine on Windows.

A container seems to have gone rogue; docker-compose rm --all caused the whole shell to freeze and restarting Docker Machine didn't help either, the container still showed up when doing docker-compose ps.

The solution was to execute docker-compose down.

Solution 3 - Docker

To solve this issue

docker-compose -f docker-compose-filename.yml down

docker-compose -f docker-compose-filename.yml up

To see all images

docker images -a

Solution 4 - Docker

Problem was solved for me by doing

docker-compose ps

finding the problematic container name and then (note running docker here)

docker rm <problematic container name>

Solution 5 - Docker

On Ubuntu 18.04.4 and Docker version 19.03.6

I tried Yogesh Yadav's answer, but

> $ docker-compose -f docker-compose-filename.yml up

command froze my terminal on running 'current locks'.

I was able to solve it by listing the containers:

$ docker-compose ps

And removing the problematic containers one by one, running:

$ docker rm <name_of_the_problematic_container>

Solution 6 - Docker

Examples using weba, webb and webc like "How to use Docker Compose to run complex multi container apps on your Raspberry Pi" suppose that you are building those images.

weba:
  build: .
  expose:
    - 80

Meaning you have (in /home/benson/Docker/HaproxyMy) a Dockerfile like this one which will be interpreted by the build . to build those images.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBenssonView Question on Stackoverflow
Solution 1 - DockerBenssonView Answer on Stackoverflow
Solution 2 - DockerMatthias BraunView Answer on Stackoverflow
Solution 3 - DockerYogesh YadavView Answer on Stackoverflow
Solution 4 - Dockersrt32View Answer on Stackoverflow
Solution 5 - DockerNisal GunawardanaView Answer on Stackoverflow
Solution 6 - DockerVonCView Answer on Stackoverflow