Guides /

Installation

/

Docker Image

Docker Image

Using this guide, you will download a compose file with everything you need to deploy your own Piwigo with Docker.


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 here

Step 1 - Installing the container

Connect to your server and create a folder named Piwigo:

  • Download the compose.yaml file from Piwigo/piwigo-docker

  • You can use curl to download it without leaving the terminal

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

  • Create a file named .env, it need to contain the following, with a strong password after the equal sign without quotes.

  • piwigo_port=8080
    db_user_password=

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

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

    porg_guides_img_docker_step1_piwigo_port

Start your container with docker compose up -d

Step 2 - Configure the reverse proxy

You will want to use an external reverse proxy with Piwigo Docker; you can use the following Nginx config examples:

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.

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;
	}
}

If you intend to host Piwigo on a subpath (eg: my_domain.tld/gallery) you will need to forward it to the container by adding proxy_set_header X-Forwarded-Prefix /my_subpath

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

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.

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.

Installation side

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

Successful installation

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

Still got some unanswered questions?

You can get some help on the forum or find your own answers in the documentation