Step-by-step tutorial for bringing traditional app into Docker world, but leave some questions and tips for brainstorming :-)
- Docker-CE 20.10+
$ vim httpServer.js
$ node httpServer.js
if possible, try to use official image, but not to create customized one
$ docker run --privileged -d \
-v $(pwd):/opt/app:ro \
-w /opt/app \
-p 8080 \
node:18-alpine \
node httpServer.js
Question: how do I expose 8080 to world?
$ cat Dockerfile
$ docker build -t http_server_image .
Question: what will happen if I change the file httpServer.js
?
$ docker run -d -p 8080 http_server_image
Question: how do I check the console log while it is running as daemon?
$ cat docker-compose.yaml
$ docker compose down && docker compose up
Question: when to use down command?
$ vim httpServer.js
$ docker compose up
Question: why is the app not updated?
$ docker compose scale web=2
Question: why this command will failed? how to achieve the scaling goal?
Question: how to setup load balancer to share loading across all the web service?
Question: hot to setup database connection between web service and database?