Setup Memos Note-Taking App with MySQL on Docker & S3 Storage

What is Memos?#

Memos is an open-source, privacy-first, and lightweight note-taking application service that allows you to easily capture and share your thoughts.
Memos features:#
- Open-source and free forever
- Self-hosting with Docker in seconds
- Pure text with Markdown support
- Customize and share notes effortlessly
- RESTful API for third-party integration
Self-Hosting Memos with Docker and MySQL Database#
You can self-host Memos quickly using Docker Compose with a MySQL database .
Prerequisites: Docker and Docker Compose installed
You have two options to choose MySQL or MariaDB as a Database both are stable versions and MariaDB consumes less memory than MySQL.
Memos with MySQL 8.0#
version: "3.0"
services:
mysql:
image: mysql:8.0
environment:
TZ: Asia/Kolkata
MYSQL_ROOT_PASSWORD: memos
MYSQL_DATABASE: memos-db
MYSQL_USER: memos
MYSQL_PASSWORD: memos
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
restart: always
memos:
image: neosmemo/memos:stable
container_name: memos
environment:
MEMOS_DRIVER: mysql
MEMOS_DSN: memos:memos@tcp(mysql:3306)/memos-db
depends_on:
mysql:
condition: service_healthy
volumes:
- ~/.memos/:/var/opt/memos
ports:
- "5230:5230"
restart: always
volumes:
mysql_data:
Memos with MariaDB 11.0#
version: "3.0"
services:
mariadb:
image: mariadb:11.0
environment:
TZ: Asia/Kolkata
MYSQL_ROOT_PASSWORD: memos
MYSQL_DATABASE: memos-db
MYSQL_USER: memos
MYSQL_PASSWORD: memos
volumes:
- mariadb_data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 10s
interval: 10s
timeout: 5s
retries: 3
restart: always
memos:
image: neosmemo/memos:stable
container_name: memos
environment:
MEMOS_DRIVER: mysql
MEMOS_DSN: memos:memos@tcp(mariadb:3306)/memos-db
depends_on:
mariadb:
condition: service_healthy
volumes:
- ~/.memos/:/var/opt/memos
ports:
- "5230:5230"
restart: always
volumes:
mariadb_data:
- Create a new file named
docker-compose.ymland copy the above content. - This sets up a MariaDB 11.0 database service and the Memos app linked to it.
- Run
docker-compose up -dto start the services in detached mode. - Memos will be available at
http://localhost:5230.
The configurations are:
mysqlservice runs MySQL 8.0 with a database namedmemos-db.memosservice runs the latest Memos images, and links to themysql/mariadbservice.MEMOS_DRIVER=mysqltells Memos to use the MySQL database driver.MEMOS_DSNcontains the database connection details.- The
~/.memosthe directory is mounted for data persistence.
You can customize the MySQL password, database name, and other settings by updating the environment variables.

Configuring S3 Compatible Storage#
Memos support integrating with S3-compatible object storage like Amazon S3 , Cloudflare R2 , DigitalOcean Spaces, etc
To use AWS S3/ Cloudflare’s R2 as object storage#

Settings > Storage
- Create a S3/Cloudflare R2 bucket
- Get the API token with object read/write permissions
- In Memos Admin
Settings > Storage, create a new storage - Enter details like Name, Endpoint, Region, Access Key, Secret Key, Bucket name and Public URL (For Cloudflare R2 set
Region = auto) - Save and select this storage

For Cloudflare R2 set Region = auto
With this setup, you can self-host the privacy-focused Memos note app using Docker Compose with a MySQL database, while integrating scalable S3 or R2 storage for persisting data.

