2022-11-01 20:01:03 -05:00
---
2023-01-25 17:07:25 +01:00
sidebar_position: 30
2022-11-01 20:01:03 -05:00
---
2022-12-21 16:01:50 -05:00
# Docker Compose [Recommended]
2022-11-01 20:01:03 -05:00
2022-12-21 16:01:50 -05:00
Docker Compose is the recommended method to run Immich in production. Below are the steps to deploy Immich with Docker Compose.
2022-11-01 20:01:03 -05:00
### Step 1 - Download the required files
2023-04-16 23:53:17 -04:00
Create a directory of your choice (e.g. `./immich-app` ) to hold the `docker-compose.yml` and `.env` files.
2022-12-21 16:01:50 -05:00
2023-04-16 23:53:17 -04:00
```bash title="Move to the directory you created"
mkdir ./immich-app
cd ./immich-app
```
Download [`docker-compose.yml` ][compose-file] and [`example.env` ][env-file], either by running the following commands:
2022-11-01 20:01:03 -05:00
```bash title="Get docker-compose.yml file"
2023-01-28 04:26:15 +01:00
wget https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
2022-11-01 20:01:03 -05:00
```
```bash title="Get .env file"
2023-01-28 04:26:15 +01:00
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
2022-11-01 20:01:03 -05:00
```
2023-04-16 23:53:17 -04:00
or by downloading from your browser and moving the files to the directory that you created.
Note: If you downloaded the files from your browser, also ensure that you rename `example.env` to `.env` .
2022-11-01 20:01:03 -05:00
### Step 2 - Populate the .env file with custom values
<details>
<summary>Example <code>.env</code> content</summary>
```bash
###################################################################################
# Database
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich
# Optional Database settings:
# DB_PORT=5432
###################################################################################
# Redis
###################################################################################
REDIS_HOSTNAME=immich_redis
# Optional Redis settings:
2023-03-11 20:41:08 +08:00
# Note: these parameters are not automatically passed to the Redis Container
# to do so, please edit the docker-compose.yml file as well. Redis is not configured
# via environment variables, only redis.conf or the command line
2022-11-01 20:01:03 -05:00
# REDIS_PORT=6379
# REDIS_DBINDEX=0
# REDIS_PASSWORD=
# REDIS_SOCKET=
###################################################################################
2023-04-16 23:53:17 -04:00
# Upload File Location
#
# This is the location where uploaded files are stored.
2022-11-01 20:01:03 -05:00
###################################################################################
UPLOAD_LOCATION=absolute_location_on_your_machine_where_you_want_to_store_the_backup
2023-04-16 23:53:17 -04:00
2022-11-01 20:01:03 -05:00
###################################################################################
# Log message level - [simple|verbose]
###################################################################################
LOG_LEVEL=simple
###################################################################################
2023-04-16 23:53:17 -04:00
# Typesense
###################################################################################
# TYPESENSE_ENABLED=false
TYPESENSE_API_KEY=some-random-text
# TYPESENSE_HOST: typesense
# TYPESENSE_PORT: 8108
# TYPESENSE_PROTOCOL: http
2022-11-01 20:01:03 -05:00
2023-04-16 23:53:17 -04:00
###################################################################################
# Reverse Geocoding
#
2022-11-01 20:01:03 -05:00
# Reverse geocoding is done locally which has a small impact on memory usage
# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable
# This ranges from 0-3 with 3 being the most precise
# 3 - Cities > 500 population: ~200MB RAM
# 2 - Cities > 1000 population: ~150MB RAM
# 1 - Cities > 5000 population: ~80MB RAM
# 0 - Cities > 15000 population: ~40MB RAM
2023-04-16 23:53:17 -04:00
####################################################################################
2022-11-01 20:01:03 -05:00
2023-04-16 23:53:17 -04:00
# DISABLE_REVERSE_GEOCODING=false
2022-11-01 20:01:03 -05:00
# REVERSE_GEOCODING_PRECISION=3
####################################################################################
# WEB - Optional
2023-04-16 23:53:17 -04:00
#
2022-11-01 20:01:03 -05:00
# Custom message on the login page, should be written in HTML form.
2023-04-16 23:53:17 -04:00
# For example:
# PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
####################################################################################
2022-11-01 20:01:03 -05:00
PUBLIC_LOGIN_PAGE_MESSAGE="My Family Photos and Videos Backup Server"
2023-04-16 23:53:17 -04:00
####################################################################################
# Alternative Service Addresses - Optional
#
# This is an advanced feature for users who may be running their immich services on different hosts.
# It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers.
# Note: immich-microservices is bound to 3002, but no references are made
####################################################################################
IMMICH_WEB_URL=http://immich-web:3000
IMMICH_SERVER_URL=http://immich-server:3001
IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
####################################################################################
# Alternative API's External Address - Optional
#
# This is an advanced feature used to control the public server endpoint returned to clients during Well-known discovery.
# You should only use this if you want mobile apps to access the immich API over a custom URL. Do not include trailing slash.
# NOTE: At this time, the web app will not be affected by this setting and will continue to use the relative path: /api
# Examples: http://localhost:3001, http://immich-api.example.com, etc
####################################################################################
#IMMICH_API_URL_EXTERNAL=http://localhost:3001
2022-11-01 20:01:03 -05:00
```
</details>
2022-12-21 16:01:50 -05:00
- Populate custom database information if necessary.
- Populate `UPLOAD_LOCATION` with your preferred location for storing backup assets.
2023-04-16 23:53:17 -04:00
- Consider changing `DB_PASSWORD` to something randomly generated
- Consider changing `TYPESENSE_API_KEY` to something randomly generated
2022-11-01 20:01:03 -05:00
### Step 3 - Start the containers
2023-04-16 23:53:17 -04:00
From the directory you created in Step 1, (which should now contain your customized `docker-compose.yml` and `.env` files) run `docker-compose up -d` .
2022-11-01 20:01:03 -05:00
```bash title="Start the containers using docker compose command"
2023-04-16 23:53:17 -04:00
docker-compose up -d # or `docker compose up -d` based on your docker-compose version
2022-11-01 20:01:03 -05:00
```
:::tip
2022-12-21 16:33:18 -05:00
For more information on how to use the application, please refer to the [Post Installation ](/docs/install/post-install.mdx ) guide.
2022-11-06 22:27:14 -05:00
:::
2022-12-21 16:01:50 -05:00
### Step 4 - Upgrading
2022-12-28 07:49:34 -08:00
When a new version of Immich is [released ](https://github.com/immich-app/immich/releases ), the application can be upgraded with the following commands, run in the directory with the `docker-compose.yml` file:
2022-12-21 16:01:50 -05:00
```bash title="Upgrade Immich"
2023-04-16 23:53:17 -04:00
docker-compose pull && docker-compose up -d # Or `docker compose up -d`
2022-12-21 16:01:50 -05:00
```
2023-01-16 19:30:50 -05:00
:::caution Automatic Updates
Immich is currently under heavy development, which means you can expect breaking changes and bugs. Therefore, we recommend reading the release notes prior to updating and to take special care when using automated tools like [Watchtower][watchtower].
:::
2023-01-28 04:26:15 +01:00
[compose-file]: https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
[env-file]: https://github.com/immich-app/immich/releases/latest/download/example.env
2023-01-16 19:30:50 -05:00
[watchtower]: https://containrrr.dev/watchtower/