Running GLPI on Docker

To get fast, reliable, and secure deployment with none of the work or hidden costs that come with self-hosting, check out GLPI Network Cloud

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

  1. Choose the folder to storage these files

  2. Create a file named docker-compose.yml

  3. Paste the example Docker compose YAML file below

    1. Here's an example docker-compose.yml file for running a stack of the latest stable GLPI version on port 80 with MySQL instance named db and database named glpion port 3306

    2. 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"
  1. Create a file named .env

  2. Paste the env variables below

GLPI_DB_HOST=db
GLPI_DB_PORT=3306
GLPI_DB_NAME=glpi
GLPI_DB_USER=glpi
GLPI_DB_PASSWORD=glpi
  1. Run the composer

docker compose up -d

Once the containers are running, you can access GLPI at http://localhost.

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 manually

  • GLPI_SKIP_AUTOUPDATE=true – GLPI will not automatically update itself, and you need to run the wizard or console commands to update it manually

If you disable the automatic installation and update, you can use the credentials set in the env file, in order to set up the GLPI instance.

  • GLPI_DB_HOST – Hostname

  • GLPI_DB_NAME – Database

  • GLPI_DB_USER – User

  • GLPI_DB_PASSWORD – Password

Find the Root MySQL Password

Please note that we set up a random root password for the MySQL database, so you will need to check the logs of the db container to find it.

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.

  1. 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;"

The root password will be the one you found in the logs of the db container previously.

Don't forget to change the <db_container_id> by the Database Container ID.

  1. 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

Don't forget to change the <glpi_container_id_> by the GLPI Container ID.

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?