Last updated: 27 May 25 12:47:01 (Europe/Berlin)

Setup Joplin Server w/ Docker

Setup Joplin Server w/ Docker

  1. Create a directory for Joplin and a data directory:
mkdir joplin
cd joplin
mkdir data
mkdir data/data
chown 1001:1001 data/data
mkdir joplin
cd joplin
mkdir data
mkdir data/data
chown 1001:1001 data/data

  1. Create the Docker compose.yml file with this contents:
services:
  db:
    image: postgres:16-alpine
    container_name: joplin_db
    env_file: .env
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    restart: unless-stopped

  app:
    image: joplin/server:latest
    env_file: .env
    container_name: joplin_app
    volumes:
      - ./data/data:/home/joplin/data
    depends_on:
      - db
    ports:
      - "127.0.0.1:22300:22300"
    restart: unless-stopped
services:
  db:
    image: postgres:16-alpine
    container_name: joplin_db
    env_file: .env
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    restart: unless-stopped

  app:
    image: joplin/server:latest
    env_file: .env
    container_name: joplin_app
    volumes:
      - ./data/data:/home/joplin/data
    depends_on:
      - db
    ports:
      - "127.0.0.1:22300:22300"
    restart: unless-stopped

  1. Create the environment file .env with the following contents and make adaptations according to your needs (see comments).
APP_BASE_URL=https://joplin.example.com  # TODO: Replace with your own URL.
APP_PORT=22300
 
DB_CLIENT=pg
POSTGRES_PASSWORD=joplin
POSTGRES_DATABASE=joplin
POSTGRES_USER=joplin  # TODO: You might want to choose a more secure password.
POSTGRES_PORT=5432
POSTGRES_HOST=db

MAILER_ENABLED=1
MAILER_HOST=smtp.example.com  # TODO: Replace with your SMTP server.
MAILER_PORT=587
MAILER_SECURITY=starttls  # Options: none, ssl, starttls
MAILER_AUTH_USER=SMTP_Username  # TODO: Replace with your SMTP user name.
MAILER_AUTH_PASSWORD=SMTP_Password  # TODO: Replace with your SMTP password.
MAILER_NOREPLY_NAME=Joplin
MAILER_NOREPLY_EMAIL=noreply@example.com  # TODO: Replace with your email.

STORAGE_DRIVER="Type=Filesystem; Path=/home/joplin/data"
STORAGE_DRIVER_FALLBACK="Type=Database; Mode=ReadAndWrite"

TZ=Europe/Berlin  # TODO: You might want to change this to your time zone.
APP_BASE_URL=https://joplin.example.com  # TODO: Replace with your own URL.
APP_PORT=22300
 
DB_CLIENT=pg
POSTGRES_PASSWORD=joplin
POSTGRES_DATABASE=joplin
POSTGRES_USER=joplin  # TODO: You might want to choose a more secure password.
POSTGRES_PORT=5432
POSTGRES_HOST=db

MAILER_ENABLED=1
MAILER_HOST=smtp.example.com  # TODO: Replace with your SMTP server.
MAILER_PORT=587
MAILER_SECURITY=starttls  # Options: none, ssl, starttls
MAILER_AUTH_USER=SMTP_Username  # TODO: Replace with your SMTP user name.
MAILER_AUTH_PASSWORD=SMTP_Password  # TODO: Replace with your SMTP password.
MAILER_NOREPLY_NAME=Joplin
MAILER_NOREPLY_EMAIL=noreply@example.com  # TODO: Replace with your email.

STORAGE_DRIVER="Type=Filesystem; Path=/home/joplin/data"
STORAGE_DRIVER_FALLBACK="Type=Database; Mode=ReadAndWrite"

TZ=Europe/Berlin  # TODO: You might want to change this to your time zone.

  1. Start the Joplin Docker containers with this command;
docker compose up -d
docker compose up -d

  1. If needed, configure your reverse proxy. Here is an example for Caddy2. Add these lines into the Caddyfile. Make sure to change joplin.example.com so that it is identical to the APP_BASE_URL in the .env File.
joplin.example.com {
        reverse_proxy localhost:22300
}
joplin.example.com {
        reverse_proxy localhost:22300
}

  1. Open the website https://joplin.example.com and log in as administrator with the initial credentials:

    • Username: admin@localhost
    • Password: admin

  1. Make sure you change the admin username and password to the values of your choice. A confirmation email will be sent asking to confirm the new administrator email address. Click on the link provided in the email to confirm.