Docker Compose: No such image

2019-03-07 20:42发布

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"

5条回答
Emotional °昔
2楼-- · 2019-03-07 21:09

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>
查看更多
该账号已被封号
3楼-- · 2019-03-07 21:11

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.

查看更多
霸刀☆藐视天下
4楼-- · 2019-03-07 21:11

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.

查看更多
不美不萌又怎样
5楼-- · 2019-03-07 21:16

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
查看更多
Anthone
6楼-- · 2019-03-07 21:21

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.

查看更多
登录 后发表回答