A small Dockerized REST API for managing tasks, built with Node.js, Express, PostgreSQL, and Docker Compose.
The project demonstrates how to containerize an application, connect multiple services through Docker networking, persist database data, validate containers automatically, and publish reusable Docker images.
Kubernetes deployment is handled by the companion project: kubernetes-task-manager.
- Node.js 22
- Express 5
- PostgreSQL 17
- Docker
- Docker Compose
- GitHub Actions
- GitHub Container Registry
Client
|
| HTTP :3000
v
Node.js / Express
Docker Container
|
| database:5432
v
PostgreSQL
Docker Container
|
v
postgres_data
Docker Volume
Docker Compose creates an internal network where the API communicates with PostgreSQL using the service hostname database.
- REST CRUD API
- PostgreSQL persistence
- Dockerized API
- Docker Compose multi-container environment
- Database health checks
- Persistent Docker volumes
- Automatic database initialization
- Parameterized SQL queries
- PowerShell helper scripts
- Docker CI validation
- Automated container image publishing
Clone the repository:
git clone https://github.com/gabrielacebal/docker-task-api.git
cd docker-task-apiStart the application:
docker compose up --buildThe API will be available at:
http://localhost:3000
Test it:
curl http://localhost:3000/tasksFor detailed setup instructions and troubleshooting, see SETUP.md.
| Method | Endpoint | Description |
|---|---|---|
| GET | /tasks |
Get all tasks |
| GET | /tasks/:id |
Get a task |
| POST | /tasks |
Create a task |
| PUT | /tasks/:id |
Update a task |
| DELETE | /tasks/:id |
Delete a task |
Example:
curl -X POST http://localhost:3000/tasks \
-H "Content-Type: application/json" \
-d '{"title":"Learn Docker"}'docker compose up --build
docker compose ps
docker compose logs -f
docker compose downReset the database:
docker compose down -vGitHub Actions validates the Docker stack on pull requests by:
- validating the Docker Compose configuration;
- building the containers;
- starting the API and PostgreSQL;
- running CRUD smoke tests;
- cleaning up the environment.
On pushes to main, the workflow also publishes the API image to GitHub Container Registry:
ghcr.io/gabrielacebal/docker-task-api
This image can then be consumed by the Kubernetes deployment project.
The Kubernetes repository is responsible for deploying and orchestrating the container image generated by this project.
docker-task-api
|
| build
v
Docker Image
|
| deploy
v
kubernetes-task-manager
This separation keeps application containerization and Kubernetes orchestration independent.
This repository is a small practical project for learning and demonstrating Docker concepts including:
- images
- containers
- networking
- volumes
- Docker Compose
- service discovery
- health checks
- container registries
- CI/CD