Home Lychee, not the fruit
Post
Cancel

Lychee, not the fruit

Do you like lychees? I bet you will like this one!
Few weeks ago, I was looking for a self-hosted solution where I can store all my travel pictures and I eventually bumped into Lychee. Lychee is a free, simple and secure photo-management-system which can be run in a Docker container. Which is basically what I was looking for! So I decided to try it out and… I loved it!
That’s how I have done it. First, I needed a big room for my pictures. A shared folder in my NAS would do the job.
I needed two more folders: a database folder (yes, we need a database) and a config folder.
Once created these folders, it was time to create the containers.

1
2
3
4
mkdir lychee
cd lychee
touch docker-compose
nano docker-compose

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
version: '3'

services:
  lychee_db:
    container_name: lychee_db
    image: mariadb:10
    environment:
      - MYSQL_ROOT_PASSWORD=YourSuperSecretRootPassword
      - MYSQL_DATABASE=lychee
      - MYSQL_USER=YourUsername
      - MYSQL_PASSWORD=YourSuperSecretPassword
    expose:
      - 3306
    volumes:
      - /path/to/db:/db

    networks:
      - lychee
    restart: unless-stopped

  lychee:
    image: lycheeorg/lychee
    container_name: lychee
    ports:
      - 90:80
    volumes:
      - /path/to/config:/conf
      - /path/to/uploads:/uploads
    networks:
      - lychee
    environment:
       - PUID=1000
       - PGID=1000
       - PHP_TZ=Europe/London
       - DB_CONNECTION=mysql
       - DB_HOST=lychee_db
       - DB_PORT=3306
       - DB_DATABASE=lychee
       - DB_USERNAME=YourUsername
       - DB_PASSWORD=YourSuperSecretPassword # has to match the above MYSQL_PASSWORD
       - STARTUP_DELAY=30
    restart: unless-stopped
    depends_on:
      - lychee_db

networks:
  lychee:

volumes:
  mysql:

After adding all variables and volumes, just write, save the changes and then:

1
sudo docker-compose up -d

Once the containers were up and running, I opened up a web browser and headed to the ip address:port where Lychee lives, set up username and password, and ta-dah! I now have my self-hosted photo-management-system.
I can upload, download, share, get details of my pictures, implement 2FA… It’s simply amazing!
I hope you like it too.

If you would like to personalise this service even more, take a look at the Lychee Documentation and edit the docker-compose.yml accordingly.

This post is licensed under CC BY 4.0 by the author.