A container is an isolated environment for running one part of an application. Docker makes containers practical for a dashboard with several moving parts: a Next.js interface, a FastAPI service, and a PostgreSQL database can each run separately. This keeps the components organized and lets them evolve independently without installing every service directly on the host machine. section 3.1 section 3.9
Build a multicontainer application in small, testable steps:
- Start one container before configuring the entire system. A generated Compose file may be a useful starting point, but verify it rather than assuming it works. section 3.2
- Declare services together in docker-compose.yml, then check that the interface can reach the API and the API can reach the database. section 3.2 section 3.3
- Record host and internal ports. A service may need an internal port without exposing a port on the host. section 3.3
Table 3.1 Container port listing
| Container name |
Host port |
Internal port |
| CloudBeaver |
|
|
| Postgres |
|
|
| Api |
|
|
| Web |
|
|
| This information is also available in the docker-compose file, but sometimes it is easier to have a reference sheet. Note that, currently, we are not exposing a Host Port for Postgres. In the next section, we’ll dig a little deeper to see why. | ||
The port table distinguishes host ports from internal ports for the web, API, database, and database-management containers. section 3.3
When the API cannot reach PostgreSQL
Check the output of docker-compose up for an earlier startup error. Then inspect the API code, requirements.txt, and Dockerfile for missing dependencies or failures. In a container-to-container connection string, use the database container’s name rather than localhost; also check that the configured credentials match. section 3.3.2
A running container is not necessarily healthy. Docker health checks can report starting, healthy, or unhealthy status; docker ps displays that status when a health check is configured. For PostgreSQL, a Dockerfile health check can run pg_isready with the configured database user. Health information supports monitoring and can inform restart behavior. section 3.8
Container configuration also matters when adding the dashboard. Its Dockerfile builds and starts the Next.js application, while a Compose build argument supplies NEXT_PUBLIC_API_URL. Because the dashboard’s API request runs in the browser, that URL uses the browser-accessible endpoint rather than an internal container address. Containers are useful beyond deployment: a disposable Docker image can provide a quick sandbox for trying another product. section 6.8 section 12.2.1




























