Running GLPI on Docker
GLPI provides an official Docker image and Stack via Dockerhub that can be used for deployments on any system that runs Docker.
If you need to report an issue.
GLPI quick start
Use this quick start to run GLPI on its latest version locally. See below for instructions running GLPI in production Assuming you have Docker installed and running, get the latest Docker image:
In order to deploy the GLPI and MySQL Stack hereby, after you install Docker, two files are needed before pulling and running the image.
A docker compose yaml file and an .env
file with environment variables used by the docker compose to correctly set up
Database host
Database host port
GLPI Database name
GLPI Database User
GLPI Database Password
Choose the folder to storage these files
Create a file named
docker-compose.yml
Paste the example Docker compose YAML file below
Here's an example
docker-compose.yml
file for running a stack of the latest stable GLPI version on port80
with MySQL instance nameddb
and database namedglpi
on port3306
Volumes will be created on the same place where the docker compose is
services:
glpi:
image: "glpi/glpi:latest"
restart: "unless-stopped"
volumes:
- "./storage/glpi:/var/glpi:rw"
env_file: .env # Pass environment variables from .env file to the container
depends_on:
db:
condition: service_healthy
ports:
- "80:80"
db:
image: "mysql"
restart: "unless-stopped"
volumes:
- "./storage/mysql:/var/lib/mysql"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_DATABASE: ${GLPI_DB_NAME}
MYSQL_USER: ${GLPI_DB_USER}
MYSQL_PASSWORD: ${GLPI_DB_PASSWORD}
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD
start_period: 5s
interval: 5s
timeout: 5s
retries: 10
expose:
- "3306"
Create a file named
.env
Paste the env variables below
Change the values to your needs if needed.
GLPI_DB_HOST=db
GLPI_DB_PORT=3306
GLPI_DB_NAME=glpi
GLPI_DB_USER=glpi
GLPI_DB_PASSWORD=glpi
Run the composer
docker compose up -d
Once the containers are running, you can access GLPI at http://localhost
.
GLPI will automatically install or update itself if needed.
You can disable this behavior by setting the environment variables below to true
in the .env
file
GLPI_SKIP_AUTOINSTALL=true
– GLPI will not automatically install itself, and you need to run the wizard or console commands to install it manuallyGLPI_SKIP_AUTOUPDATE=true
– GLPI will not automatically update itself, and you need to run the wizard or console commands to update it manually
GLPI_DB_HOST
– HostnameGLPI_DB_NAME
– DatabaseGLPI_DB_USER
– UserGLPI_DB_PASSWORD
– Password
Find the Root MySQL Password
docker logs <db_container_id>
Enable Timezones Support
If you want to initialize the timezones support for GLPI, we need to first GRANT the glpi user access to mysql.time_zone
table.
With the docker container running, run the following command:
docker exec -it <db_container_id> mysql -u root -p -e "GRANT SELECT ON mysql.time_zone_name TO 'glpi'@'%';FLUSH PRIVILEGES;"
Run the following command to initialize the timezones on the GLPI container:
docker exec -it <glpi_container_id> /var/www/glpi/bin/console database:enable_timezones
Volumes
By default, the glpi/glpi
image provides a volume containing its config
, marketplace
and files
directories. For GLPI 10.0.x version, the marketplace directory is not declared in the volume as the path differs. You may want to create a manual volume for the path /var/www/glpi/marketplace
if you plan to use it.
Tags
In order for users to have different options for testing and deploying GLPI in different versions, even though the latest versions are always recommended, the GLPI Official Docker Composer allows you to choose between different tags containing different versions of GLPI deployment.
GLPI Tags are in the docker compose file, on the line with the image name, where you may change to image: "glpi/glpi:11.0.0-nightly"
to install GLPI 11 RC1 on Docker
See more tags here - https://hub.docker.com/r/glpi/glpi/tags
Last updated
Was this helpful?