Lychee照片管理系统Docker镜像,集成nginx和PHP-FPM,遵循官方推荐配置,支持amd64、arm64、armv6、armv7等多种架构,可快速部署个人或家庭照片库,支持SQLite、MySQL、PostgreSQL等数据库。
Table of Contents
- Image content
- Setup
- Quick Start
- Prerequisites
- Run with Docker
- Run with Docker Compose
- Available environment variables and defaults
- Advanced configuration
Image Content
This image features Lychee, nginx and PHP-FPM. The provided configuration (PHP, nginx...) follows Lychee's official recommendations.
The following tags are available :
latest: Latest Lychee releasev[NUMBER]: Stable version tag for a Lychee releasenightly(alsodev): Current master branch tag (Lychee operates on a stable master, so this should usually be safe)devtools: As above, but includes development dependenciestesting: Tag for testing new branches and pull requests. Designed for internal use by LycheeOrgalpha: Current alpha branch tag (The alpha branch contains bleeding edge changes that are not peer-reviewed)alpha-devtools: As above, but includes development dependencies
Setup
Quick Start
To use the built-in SQLite support, no external dependencies are required. At its simplest, docker run -p 80 lycheeorg/lychee:dev will start Lychee listening on a random port on the local host.
For more runtime options, look below in Run with Docker and Available environment variables and defaults.
Prerequisites
To use this image with MySQL, MariaDB or PostgreSQL you will need a suitable database running externally. This may be through a Docker image, possibly in your docker-compose.yml.
- Create the db, username, password.
- Edit the environment variables (db credentials, language...) by :
- Supplying the environment variables via
docker run/docker-composeor - Creating a
.envfile with the appropriate info and mount it to/conf/.envor - Use the Lychee installer by passing
-e DB_CONNECTION=on the command line and connecting to the container with your browser
- Supplying the environment variables via
Run with Docker
Make sure that you link to the container running your database !!
The example below shows --net and --link for these purposes. --net connects to the name of the network your database is on and --link connects to the database container.
bashdocker run -d \ --name=lychee \ -v /host_path/lychee/conf:/conf \ -v /host_path/lychee/uploads:/uploads \ -v /host_path/lychee/sym:/sym \ -e PUID=1000 \ -e PGID=1000 \ -e PHP_TZ=America/New_York \ -e TIMEZONE=America/New_York \ -e DB_CONNECTION=mysql \ -e DB_HOST=mariadb \ -e DB_PORT=3306 \ -e DB_DATABASE=lychee \ -e DB_USERNAME=user \ -e DB_PASSWORD=password \ -p 90:80 \ --net network_name \ --link db_name \ lycheeorg/lychee
Warning : if you use a MySQL database, make sure to use the mysql_native_password authentication plugin, either by using the --default-authentication-plugin option when starting mysql, or by running a query to enable the authentication plugin for the lychee user, e.g. :
alter user 'lychee' identified with mysql_native_password by '<your password>';
Run with Docker Compose
Change the environment variables in the https://github.com/LycheeOrg/Lychee-Docker/blob/master/docker-compose.yml to reflect your database credentials.
Note that in order to avoid writing credentials directly into the file, you can create a db_secrets.env and use the env_file directive (see the https://docs.docker.com/compose/environment-variables/#the-env_file-configuration-option).
Create admin account during first run
When ADMIN_USER and ADMIN_PASSWORD (or ADMIN_PASSWORD_FILE) are set an admin user will be created with those credentials during the first run. Otherwise Lychee will prompt in the browser when first loaded.
Docker secrets
As an alternative to passing sensitive information via environment variables, _FILE may be appended to some of the environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in /run/secrets/<secret_name> files.
If both the original variable and the _FILE (e.g. both DB_PASSWORD and DB_PASSWORD_FILE) are set, the original variable will be used.
The following _FILE variables are supported:
- DB_PASSWORD_FILE
- REDIS_PASSWORD_FILE
- MAIL_PASSWORD_FILE
- ADMIN_PASSWORD_FILE
Available environment variables and defaults
If you do not provide environment variables or .env file, the https://github.com/LycheeOrg/Lychee/blob/master/.env.example will be used with some values already set by default.
Some variables are specific to Docker, and the default values are :
PUID=1000PGID=1000USER=lycheePHP_TZ=UTCSTARTUP_DELAY=0
Advanced configuration
Note that nginx will accept by default images up to 100MB (client_max_body_size 100M) and that PHP parameters are overridden according to the https://lycheeorg.github.io/docs/faq.html#i-cant-upload-large-photos.
You may still want to further customize PHP configuration. The first method is to mount a custom php.ini to /etc/php/8.2/fpm/php.ini when starting the container. However, this method is kind of brutal as it will override all parameters. It will also need to be remapped whenever an image is released with a new version of PHP.
Instead, we recommend to use the PHP_VALUE directive of PHP-FPM to override specific parameters. To do so, you will need to mount a custom nginx.conf in your container :
- Take the default.conf file as a base
- Find the line starting by
fastcgi_param PHP_VALUE [...] - Add a new line and set your new parameter
- Add or change any other parameters (e.g.
client_max_body_size) - Mount your new file to
/etc/nginx/nginx.conf
If you need to add (not change) nginx directives, files mounted in /etc/nginx/conf.d/ will be included in the http context.
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务