Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 390
Dora Avatar asked Dec 03 '17 05:12

Dora


People also ask

Does Docker compose up build images?

From your project directory, start up your application by running docker compose up . Compose pulls a Redis image, builds an image for your code, and starts the services you defined.

Is Docker compose separate from docker?

A Dockerfile is a simple text file that contains the commands a user could call to assemble an image whereas Docker Compose is a tool for defining and running multi-container Docker applications. Docker Compose define the services that make up your app in docker-compose.

Does Docker compose pull images?

If you run docker compose pull ServiceName in the same directory as the compose. yaml file that defines the service, Docker pulls the associated image.

Does Docker compose replace Dockerfile?

No, Dockerfile instructs Docker how to build your image(s). Docker Compose instructs Docker how to run your image(s). Thx, so I have to make a dockerfile just to have the copy command ?


1 Answers

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

like image 183
Dora Avatar answered Sep 21 '22 06:09

Dora