Docker Tutorial | Nodejs + Express + Mongodb + React + Redis + Nginx
How to use Docker to build and develop Nodejs, Express, Mongodb, React, and Redis applications.
How to use Docker with Nginx and Gitlab to automatically deploy to DigitalOcean.
Author: Dev A.T Viet Nam
https://youtu.be/Cl0lXkzMuuo
Youtube:Getting started:
cd api
docker build -t devatvietnam/rest-api:v1 .
docker run -it --rm --name rest-api -p 5000:5000 devatvietnam/rest-api:v1
π₯
Donate
π Buy Me a Coffee . Thank You !π :π https://www.buymeacoffee.com/QK1DkYSπ Paypal : https://paypal.me/tuananh251192
π»
π»
VietNam:
π Vietcombank: 0061001044348 (LE TUAN ANH)π Momo : 0374481936
Commonly used commands in docker:
-
Build a image.
-docker build -t "image-name" .
-docker build -f "Dockerfile.dev" -t "image-name" .
-
Run a container.
-docker run -it --rm --name "container-name" -p 5000:5000 "image-name"
-docker run -it -d --rm --name "container-name" -p 5000:5000 "image-name"
- with -d: detach -> run a container in the background. -
Stop a container.
-docker stop "container-name"
-
Stop all running containers.
-docker stop $(docker ps -a -q)
-
Show all images.
-docker images
-
Delete a image.
-docker rmi "image-id|image-name"
-
Delete all images.
-docker rmi $(docker images -q)
-
Show all running containers.
-docker ps
-
Show all containers.
-docker ps -a
-
Delete a stopped container.
-docker rm "container-name"
-
Delete all stopped containers.
-docker rm $(docker ps -a -q)
-
Kill all running containers.
-docker kill $(docker ps -q)
Commonly used commands in docker-compose:
-
Build and rebuild a image.
-docker-compose up --build
-docker-compose -f "docker-compose.dev.yml" up --build
-
Run and start containers.
-docker-compose up
-docker-compose -f "docker-compose.dev.yml" up
-
Stop and clear containers.
-docker-compose down
-docker-compose -f "docker-compose.dev.yml" down
-
Stop and clear containers, volumes.
-docker-compose down -v
-docker-compose -f "docker-compose.dev.yml" down -v