{"slug": "self-host-memos-with-docker-compose-a-production-setup-guide", "title": "Self-Host Memos with Docker Compose: A Production Setup Guide", "summary": "A developer published a production setup guide for self-hosting Memos, an open-source, timeline-based note-taking app, using Docker Compose. The guide covers a single-container deployment with an embedded SQLite store, a named volume at /var/opt/memos for the database and attachments, localhost-only port binding on 5230, and reverse-proxy configuration examples for Caddy and Nginx that forward Host and X-Forwarded-Proto headers. It advises registering the first account as admin before public exposure and notes that no separate database or cache container is needed for a standard deployment.", "body_md": "This tutorial was written with AI assistance from the project's official documentation. Verification status is stated at the end of the article.\n\nMemos is a self-hosted note-taking app built around a personal timeline. Each memo is timestamped, Markdown-capable, and taggable, so short thoughts and longer entries live in one searchable stream. You control visibility per memo: private, shared with specific users, or public on the web. The app ships as a single Go binary with an embedded SQLite store by default, which makes it one of the lighter services to run on a VPS.\n\nThe upstream project does not publish a minimum RAM figure. Practical sizing depends on workload: an idle instance with a handful of users and a few thousand memos runs comfortably in a small container, while heavy attachment uploads, large media libraries, and many concurrent users push memory and disk usage up. Watch the volume size more than the RAM line.\n\nEverything Memos keeps lives under `/var/opt/memos` inside the container. That directory holds the SQLite database, uploaded attachments, and generated thumbnails. Back it up as a unit.\n\n`docker compose version`).` 127.0.0.1:5230` first.`5230` is the documented HTTP port. Bind it to localhost and let a reverse proxy terminate TLS.`memos_data`, mounted at `/var/opt/memos`. Do not use a bind mount to an arbitrary host path; a named volume keeps ownership and permissions consistent across image upgrades.`neosmemo/memos`. Tags: `stable` follows stable releases, a month tag like `26.10` pins to that month's stable release, and `canary` follows development builds. Use Memos does not need a separate database or cache container for a standard deployment. SQLite is embedded. If you later move to an external database, that is a configuration change, not a Compose dependency you need on day one.\n\nCreate a working directory and write the Compose file and environment file.\n\n```\nmkdir -p ~/memos && cd ~/memos\ncat <<'EOF' > compose.yml\nservices:\n  memos:\n    image: neosmemo/memos:${MEMOS_TAG:-stable}\n    container_name: memos\n    restart: unless-stopped\n    ports:\n      - \"127.0.0.1:${MEMOS_PORT:-5230}:5230\"\n    environment:\n      TZ: ${TZ:-UTC}\n    volumes:\n      - memos_data:/var/opt/memos\n\nvolumes:\n  memos_data:\nEOF\n```\n\nGenerate the environment file. Memos itself does not require a secret in the container environment for a single-instance SQLite deployment; the first account you create becomes the admin. Keep the file for timezone, port, and image tag so the stack is reproducible.\n\n```\ncat <<EOF > .env\nTZ=UTC\nMEMOS_PORT=5230\nMEMOS_TAG=stable\nEOF\n```\n\nStart the stack:\n\n```\ndocker compose up -d\ndocker compose logs -f memos\n```\n\nYou should see the server bind on `5230`. Open `http://127.0.0.1:5230` from the host, or tunnel it from your laptop:\n\n```\nssh -L 5230:127.0.0.1:5230 user@your-server\n```\n\nThen visit `http://localhost:5230` locally. The first account you register is the admin. Do that before you expose the instance publicly.\n\nMemos is a normal HTTP app behind a proxy. The important details:\n\n`Host` and `X-Forwarded-Proto` so generated links and the web UI use the correct scheme.`Upgrade`/` Connection` headers will cause reconnect loops.\nCaddy example (`/etc/caddy/Caddyfile`):\n\n```\nmemos.example.com {\n    encode zstd gzip\n    request_body {\n        max_size 25MB\n    }\n    reverse_proxy 127.0.0.1:5230 {\n        header_up X-Forwarded-Proto {scheme}\n        header_up Host {host}\n    }\n}\n```\n\nNginx example:\n\n```\nserver {\n    listen 443 ssl http2;\n    server_name memos.example.com;\n\n    client_max_body_size 25m;\n\n    location / {\n        proxy_pass http://127.0.0.1:5230;\n        proxy_http_version 1.1;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n    }\n}\n```\n\nFirst-run hardening checklist:\n\nUpdate the image and restart:\n\n```\ncd ~/memos\ndocker compose pull\ndocker compose up -d\ndocker compose logs -f memos\n```\n\nBack up the data volume. Stop the container first so SQLite is not mid-write:\n\n```\ndocker compose stop memos\ndocker run --rm \\\n  -v memos_memos_data:/data \\\n  -v \"$PWD\":/backup \\\n  alpine tar czf /backup/memos-$(date +%F).tar.gz -C /data .\ndocker compose start memos\n```\n\nThe volume name is `<project>_memos_data`; if your directory is `~/memos`, the project name is `memos`, so the volume is `memos_memos_data`. Confirm with `docker volume ls`.\n\nTwo pitfalls worth knowing from the docs:\n\n`store/migration/README.md` explain why; skipping it can leave the database in a state the current image will not open.`MEMOS_TAG` to a month tag such as One more operational note: attachments live inside the same volume as the database. A backup that copies only the SQLite file will restore your memos without their images. Archive the whole `/var/opt/memos` tree, as the command above does.\n\n**Measured in our sandbox run:** total memory 18.5 MB (sum of per-container peaks over a 30s idle window after startup) across 1 container; largest container 18.5 MB; published port(s) 5230; HTTP probe returned 200. The run took 41.5s including the image download.\n\n*Verification: we ran this docker-compose stack in a disposable Docker environment and recorded the measurements above. They describe that run, not a guarantee for your host.*\n\n*Originally published with full interactive benchmark metrics and server sizing notes at [https://benchrun.pages.dev/self-host-memos-docker-compose/](https://benchrun.pages.dev/self-host-memos-docker-compose/).*", "url": "https://wpnews.pro/news/self-host-memos-with-docker-compose-a-production-setup-guide", "canonical_source": "https://dev.to/gongkang/self-host-memos-with-docker-compose-a-production-setup-guide-1m33", "published_at": "2026-11-18 12:00:39+00:00", "updated_at": "2026-11-18 12:13:38.362777+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Memos", "Docker Compose", "SQLite", "Caddy", "Nginx"], "also_reported_by": [], "takeaway": "Run Memos as a single container with a named volume mounted at /var/opt/memos to keep the SQLite database and attachments consistent across image upgrades, bind port 5230 to localhost, and let a reverse proxy set Host and X-Forwarded-Proto.", "recommendation": {"advice": "For a single-instance Memos deployment, use a named volume at /var/opt/memos instead of a bind mount and bind port 5230 to 127.0.0.1 behind a TLS-terminating proxy.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/self-host-memos-with-docker-compose-a-production-setup-guide", "markdown": "https://wpnews.pro/news/self-host-memos-with-docker-compose-a-production-setup-guide.md", "text": "https://wpnews.pro/news/self-host-memos-with-docker-compose-a-production-setup-guide.txt", "jsonld": "https://wpnews.pro/news/self-host-memos-with-docker-compose-a-production-setup-guide.jsonld"}}