Piwigo, Docker - "Cannot connect to server"

Here’s a working YAML I ended up trial/erroring. Be sure to replace both passwords with something stronger and adjusting the data volumes so they match your host directories. You can change port 21212 to something else you prefer as well

version: “3.1”
services:
db:
image: linuxserver/mariadb:latest
restart: always
container_name: piwi_db
environment:
- MYSQL_ROOT_PASSWORD=asdfasdf
- MYSQL_USER=piwigouser
- MYSQL_PASSWORD=asdfasdf
- MYSQL_DATABASE=piwigo
volumes:
- /home/hostcomputeruser/Docker/piwigo/db:/var/lib/mysql
app:
image: linuxserver/piwigo
container_name: piwi_app
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- /home/hostcomputeruser/Docker/piwigo/conf:/config
- /home/hostcomputeruser/Docker/piwigo/pics:/pictures
ports:
- 21212:80
restart: unless-stopped

Save the yaml into a docker-compose.yml file and run sudo docker-compose up -d from the same directory. Browse to http://localhost:21212 for the setup and enter:

  • db for Host (service_name defined in the docker-compose file)
  • piwigo for User (MYSQL_USER defined in compose)
  • asdfasdf for Password (MYSQL_PASSWORD)
  • piwigo for Database name (MYSQL_DATABASE)
  • piwigo_ for Database tables prefix (filled in already)

For the Admin config, you can enter what you prefer, but be sure to record/remember it as it is how you will administer Piwigo

Here’s a screenshot of the settings entered:
https://i.imgur.com/jh6TT6Y.png
I would paste another screenshot of the success screen, but I am a new user and cannot post more URLs

Hope this helps someone