Switch to Linux containers first
docker compose watch
Traefic is configured to use:
ports:
- 8082:80
So we use port 8082
to connect to our container apps.
Treafic acts like a loadbalancer, all requests go through treaffic.
This project provides a sample todo list application. It demonstrates all of the current Docker best practices, ranging from the Compose file, to the Dockerfile, to CI (using GitHub Actions), and running tests. It's intended to be a well-documented to ensure anyone can come in and easily learn.
This sample application is a simple React frontend that receives data from a Node.js backend.
When the application is packaged and shipped, the frontend is compiled into static HTML, CSS, and JS and then bundled with the backend where it is then served as static assets. So no... there is no server-side rendering going on with this sample app.
During development, since the backend and frontend need different dev tools, they are split into two separate services. This allows Vite to manage the React app while nodemon works with the backend. With containers, it's easy to separate the development needs!
To spin up the project, simply install Docker Desktop and then run the following commands:
git clone https://github.com/docker/getting-started-todo-app
cd getting-started-todo-app
docker compose up -d
You'll see several container images get downloaded from Docker Hub and, after a moment, the application will be up and running! No need to install or configure anything on your machine!
Simply open to http://localhost to see the app up and running!
Any changes made to either the backend or frontend should be seen immediately without needing to rebuild or restart the containers.
To help with the database, the development stack also includes phpMyAdmin, which
can be access at http://db.localhost (most browsers will resolve *.localhost
correctly, so no hosts file changes should be required).
When you're done, simply remove the containers by running the following command:
docker compose down
⚡️ docker-compose up --build
🔹 What it does: Builds all images defined in the docker-compose.yml file (if needed).
Starts all containers.
Rebuilds only once, during startup.
Static — does not watch for file changes.
✅ Use it when: You want to (re)build and start your app stack once.
You made changes to the Dockerfile or source and want a fresh build.
No need for hot reload or live code sync.
docker-compose up --build
🔁 docker compose watch (Compose Watch) 🆕 Requires Docker Compose v2.20+.
🔹 What it does: Monitors file changes on your host machine.
Automatically syncs files or rebuilds containers based on your develop: section in docker-compose.yml.
Enables hot reload / live development behavior.
Used in combination with docker compose up.
✅ Use it when: You're developing an app and want automatic reloads on code change.
You use the develop.watch section to configure per-service file sync or rebuild triggers.
Example:
docker compose up --build # Start services
docker compose watch # In a second terminal, starts file watchers
🔍 Summary Table Command Rebuilds? Watches Files? Dev-friendly Use Case docker-compose up --build ✅ once ❌ 🔸 Partial One-time build & launch docker compose watch ✅ live ✅ ✅ Best Live dev: auto-rebuild/sync files
🚀 Best Practice in Dev: Add a develop: block in docker-compose.yml
Run:
docker compose up --build
docker compose watch
Let me know if you want help writing a develop: config for your services or checking if your Docker version supports it.