Docker: Uses an image, skipping (docker-compose)

88,751

Solution 1

I found out, I was being stupid.

I didn't need to run docker-compose build I can just directly run docker-compose up since then it'll pull the images down, the build is just to build locally

Solution 2

in my case below command worked:

docker-compose up --force-recreate

I hope this helps!

Solution 3

Clarification: This message (<service> uses an image, skipping) is NOT an error. It's informing the user that the service uses Image and it's therefore pre-built, So it's skipped by the build command.

In other words - You don't need build , you need to up the service.

Solution:

run sudo docker-compose up <your-service>

PS: In case you changed some configuration on your docker-compose use --force-recreate flag to apply the changes and creating it again.

sudo docker-compose up --force-recreate <your-service>

Solution 4

My problem was that I wanted to upgrade the image so I tried to use:

  • docker build --no-cache
  • docker-compose up --force-recreate
  • docker-compose up --build

None of which rebuild the image.

What is missing ( from this post ) is:

docker-compose stop
docker-compose rm -f # remove old images
docker-compose pull  # download new images
docker-compose up -d
Share:
88,751

Related videos on Youtube

Dora
Author by

Dora

learning to be a web developer. Just started so much to learn. Anyone need volunteers I need some work experience :P

Updated on November 02, 2021

Comments

  • Dora
    Dora over 2 years

    I am currently trying out this tutorial for node express with mongodb https://medium.com/@sunnykay/docker-development-workflow-node-express-mongo-4bb3b1f7eb1e

    the first part works fine where to build the docker-compose.yml it works totally fine building it locally so I tried to tag it and push into my dockerhub to learn and try more.

    this is originally what's in the yml file followed by the tutorial

    version: "2"
    services:
      web:
        build: .
        volumes:
          - ./:/app
        ports:
          - "3000:3000"
    

    this works like a charm when I use docker-compose build and docker-compose up

    so I tried to push it to my dockerhub and I also tag it as node-test

    I then changed the yml file into

    version: "2"
    services:
      web:
        image: "et4891/node-test"
        volumes:
          - ./:/app
        ports:
          - "3000:3000"
    

    then I removed all images I have previously to make sure this also works...but when I run docker-compose build I see this message error: web uses an image, skipping and nothing happens.

    I tried googling the error but nothing much I can find.

    Can someone please give me a hand?

    Thanks in advance

    • Markus W Mahlberg
      Markus W Mahlberg over 6 years
      „Your“ dockerhub? Please clarify: your own registry or your account on docker.io
    • Dora
      Dora over 6 years
      @MarkusWMahlberg https://hub.docker.com/ this place...
    • Markus W Mahlberg
      Markus W Mahlberg over 6 years
    • Dora
      Dora over 6 years
      @MarkusWMahlberg yes, also the same happend to lab4.1 which works perfectly in school today.
  • jean d'arme
    jean d'arme over 4 years
    It might be worth expanding a bit on it: if instead of build (which you can only do by pointing to specific Dockerfile) you use image then there is nothing to build because you directly use image from docker repository.
  • Jimbo
    Jimbo about 4 years
    But this is UP, not BUILD. Didn't op want to build?
  • tnkh
    tnkh almost 4 years
    THis is to recreate the container with any changes, so similiar with build
  • John Xiao
    John Xiao over 3 years
    If the image is built locally, then need steps like this: docker build -t <image name> <directory> to build locally, docker-compose up -d <service name> to recreate container and start it.