Leantime is an open source project management system for small teams and startups written in PHP, Javascript using MySQL. https://leantime.io
This is the official Docker image for Leantime. It was built using the latest Leantime release.
Below you will find examples on how to get started with Leantime trough docker run
or docker compose
.
git clone https://github.com/Leantime/docker-leantime.git
cd docker-leantime
cp sample.env .env
Edit .env file with your settings and then run
docker compose up -d
docker network create leantime-net
docker run -d --restart unless-stopped -p 3306:3306 --network leantime-net \
-e MYSQL_ROOT_PASSWORD= changeme123 \
-e MYSQL_DATABASE=leant ime \
-e MYSQL_USER=lean \
-e MYSQL_PASSWORD=chang eme123 \
--name mysql_leantime mysql:8.4
By default, Leantime runs on port 8080 internally.
To map port 80 externally to 8080 internally in docker-compose.yml:
ports: - "80:8080"
Add the user
directive to your docker-compose.yml:
services:
leantime:
image: leantime/leantime:latest
user: leantime
...
Or with docker run:
docker run --user leantime ...
You can also map the container's internal user/group to match your host's user/group by setting the PUID
and PGID
environment variables. This helps avoid permission issues between the container and host machine. To find your host user/group ID, run id username
on the host system. For example, to run the container as your current user, you would set:
docker run -e PUID=$(id -u) -e PGID=$(id -g) leantime/leantime:latest
Or in docker-compose.yml:
services:
leantime:
environment:
- PUID=1000 # Replace with your user ID
- PGID=1000 # Replace with your group ID
Important directories that should be persisted:
volumes:
- public_userfiles:/var/www/html/public/userfiles # Public files, logos
- userfiles:/var/www/html/userfiles # User uploaded files
- plugins:/var/www/html/app/Plugins # Plugin directory
- logs:/var/www/html/storage/logs # Application logs
As an alternative to passing sensitive information via environment variables, _FILE
may be appended to the environment variables listed below, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in /run/secrets/<secret_name>
files. For example:
docker run -d --restart unless-stopped -p 80:80 --network leantime-net \
-e LEAN_DB_HOST=mysql_leantime \
-e LEAN_DB_USER=admin \
-e LEAN_DB_PASSWORD_FILE=/run/secrets/lean-db-password \
-e LEAN_DB_DATABASE=leantime \
--name leantime leantime/leantime:latest
Currently, this is only supported for LEAN_DB_PASSWORD
, LEAN_EMAIL_SMTP_PASSWORD
, LEAN_S3_SECRET
, and LEAN_SESSION_PASSWORD
.
If you see "Operation not permitted" errors:
- Ensure volumes are properly created
- Check ownership of mounted directories
- Run container as root (default) or properly configure user permissions
Fix permissions manually:
docker exec -it leantime chown -R www-data:www-data /var/www/html/userfiles \
/var/www/html/public/userfiles \
/var/www/html/storage/logs \
/var/www/html/app/Plugins
docker exec -it leantime chmod -R 775 /var/www/html/userfiles \
/var/www/html/public/userfiles \
/var/www/html/storage/logs \
/var/www/html/app/Plugins
- Verify database credentials in .env file
- Ensure database container is running and healthy
- Check network connectivity between containers
- Ensure the plugins volume is properly mounted
- Check write permissions on the plugins directory
- Verify plugin compatibility with your Leantime version
- Check logs:
docker logs leantime
- Verify port mappings
- Ensure no conflicts with host ports
See sample.env for all available options. Critical variables:
LEAN_DB_HOST=mysql_leantime
LEAN_DB_USER=lean
LEAN_DB_PASSWORD=changeme123
LEAN_DB_DATABASE=leantime
LEAN_SESSION_PASSWORD=your_secure_password
- Always change default passwords
- Use Docker secrets for sensitive data
- Consider running as non-root user
- Enable HTTPS in production
- Restrict network access appropriately