Usage of CodeCarbon with Docker
July 12, 2025 ยท View on GitHub
Prerequisites
Clone the project
git clone https://github.com/mlco2/codecarbon/codecarbon.git
Prepare configuration:
cd codecarbon
cp docker/docker.env .env
Run
docker-compose up -d
This will run :
- Postgresql on localhost:5480
- PGAdmin 4 on http://localhost:5080 login : test@test.com , password : test (Dans PGAdmin, use the host postgres_codecarbon and port 5432 for in docker network access)
- CodeCarbon API on http://localhost:8008
Stop
docker-compose down
Postgres database and PGAdmin configuration are saved in separate volumes.
View logs
docker logs codecarbon-api_codecarbon_api_1
Execute tests
docker exec codecarbon-api_codecarbon_api_1 uv run task test-api-integ
Force build
docker-compose up --build
Cleaning
Delete all files :
docker-compose down -v
docker image rm codecarbon-api