Answer a question

I created an image called myrepo/myimage:0.0.1 and pushed it to my docker hub repo using the push command.

After that I tried running docker-compose up from the directory where my docker-compose.yml is located to bring that image up. However, if I don't specify the image version I get the following error: ERROR: manifest for myrepo/myimage not found: manifest unknown: manifest unknown.

My docker-compose.yml looks like this:

    version: '2'
services:
    postgres_globally_united:
        image: postgres
        ports:
            - "3460:5432"
        environment:
            - POSTGRES_USER=postgres
            - POSTGRES_PASSWORD=agjAFk3!Rk2#!lapA@
        image: myrepo/myimage
        ports:
            - "7001:80"

I also tried doing it by defining the image like this in docker-compose.yml: myrepo/myimage:latest. However, I got the similar error.

How can I make Docker get the latest image. I see that for the postres image it works just fine...

Answers

You need to provide the specific tag of your image in the compose file or tag the image as latest and push that.

docker tag myrepo/myimage:0.0.1 myrepo/myimage:latest
docker push myrepo/myimage:latest

latest is not automatically created for you, if you build/push with a specific tag. If you leave the tag off, then latest will be used as the default tag.

Also note that you can provide multiple tags when building, which may be more convenient than building with one tag and tagging it again.

docker build --tag myrepo/myimage:latest --tag myrepo/myimage:0.0.1 .
Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐