Running Lires with docker provide another level of isolation and security.
# build the image
docker build -f docker/Dockerfile -t lires:runtime .
# run the container, map the port 8080 to the host machine port 80
docker run -d -p 80:8080 -v </path/to/data>:/root/.Lires --name lrs lires:runtime
Now you can access the web interface at http://localhost
.
# user management
docker exec -it lrs lrs-user ...
# check the logs
docker exec -it lrs lrs-log ...
# or check output by docker logs
docker logs -f lrs
The docker image essentially runs the lrs-cluster
command with the configuration file /root/.Lires/container-cluster.yaml
.
Which should be mounted to the host machine for easy access and modification.
::: info
Although you may change the environment variables with docker run -e ...
,
it is recommended to modify them in the cluster configuration file,
to make sure it will not be overwritten by the values set with the configuration file.
:::
An advantage of running the app with docker is that you can limit the resources of the container.
To limit the memory and cpu usage, you can use the --memory
and --cpus
flags.
docker run --memory 4g --cpus 2 ...
To limit the disk usage, you can use the docker volume driver, for example, first create a volume with limited size, then mount it to the container.
# create a volume with 10G size
docker volume create --driver local --opt type=btrfs --opt o=size=10G lrs-data
# run the container with the volume
docker run -v lrs-data:/root/.Lires ...
For more information, see docker - driver specific options.