I'm writing this because I keep forgetting Docker.
Make sure you have Docker Desktop.
All you need to know from start to finish:
- Image (a blueprint) -> Container (a running service based on the image) That's it!
- First know how to build images.
- Then know how to run containers from images.
# First write a Dockerfile... (you do it)
# Then in the same folder, run the commands:
docker build . -t 'image-name'
# or
docker build . --tag 'image-name'
# After running, you will see the image under "Images" in Docker Desktop.# There are a bunch of ways, but here's my recommended command for you, for no ambiguity:
docker run -d -p 3000:3000 --name 'container-name' 'image-name'
# To note:
# - 3000 (on the left is the host machine, your computer, what you can access in your browser)
# - 3000 (on the right is the Docker, the port where your service is running)
# 'container-name' - use any container name, it will show up on the Docker Desktop under "Containers"
- 'image-name' - use the image name you used to build earlier.