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
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.
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.
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.
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 ?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With