Skip to content

Installation Docker

Docker install requirements

This guide assume you can connect to your server via ssh and already have installed docker, if that's not the case follow the official docker documentation

Step 1 - Installing the container

Connect to your server and create a folder named Piwigo then download the compose.yaml from the Piwigo/piwigo-docker repository inside it.

You can use curl to download compose.yaml without leaving the terminal :

curl -O "https://raw.githubusercontent.com/Piwigo/piwigo-docker/refs/heads/main/compose.yaml"

Create a file named .env with the following :

piwigo_port=8080
db_user_password=
timezone=
piwigo_port= # the exposed port by docker
db_user_password= # Database password
timezone= # Container timezone
PIWIGO_UID= # the UID of the user who will own the Piwigo folder
PIWIGO_GID= # the GID of the group who will own the Piwigo folder
piwigo_port=8080
db_user_password=
timezone=UTC
PIWIGO_UID=1000
PIWIGO_GID=1000
piwigo_port=10004
db_user_password=Nkhcfnfk5GmpnLGIFoIDJqRFPW22C7PlyEUYVaB1lkte5Dn0wOQs3TI4wom1E4A6
timezone=Europe/Paris
PIWIGO_UID=1001
PIWIGO_GID=1004

Tip

You can use the following command to generate a valid password :

printf $(tr -dc '[:alnum:]' </dev/urandom | head -c64)"\n" 

Start your container with : docker compose up -d.
You can read the logs with docker compose logs.

Step 2 - Configure the reverse proxy

It's advised to use the piwigo container behing a Reverse proxy like NGINX

Info

Piwigo supports being hosted on a domain, subdomain, and/or subpath; whatever you choose, it's advised to not use the Piwigo release number in the URL.

You can use the following Nginx config examples :

If you changed piwigo_port in .env you will also need to modify the proxy_pass section to reflect that.
Keep in mind that Docker will ignore all your firewall rules by design.

server {
  listen 80;
  server_name my_domain.tld;
  location / {
    proxy_pass http://127.0.0.1:8080/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

f you intend to host Piwigo on a subpath like my_domain.tld/gallery, you will need to forward it to the container by adding proxy_set_header X-Forwarded-Prefix /gallery

server {
  listen 80;
  server_name my_domain.tld;
  location /gallery/ {
    proxy_pass http://127.0.0.1:8080/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Prefix /gallery;
  }
}

Step 3 - Configuration

Once the container is started and your reverse proxy is configured, open a web browser to the web address you are hosting Piwigo on. Piwigo will detect nothing is installed yet, and redirect you to the installation page

Installation side

Fill in MySQL database connection settings with the following :

  • Host : piwigo-db:3306
  • User : piwigodb_user
  • Password : Use the password you wrote in the .env file
  • Database name : piwigodb
  • A prefix for Piwigo table names : piwigo_

The following is required to create the webmaster account :

  • An account identifier, chosen by you
  • A password you have to enter twice, for checking
  • Your email address, so that visitors can contact you

Run the “Start Install” action.

Successful installation

You will be informed about either success or failure of the installation process.

Step 4 - First connection

Once the installation is finished, you can go into your gallery. Login with your webmaster account, and you can reach the administration panel.

Piwigo is installed