Sign in

mastodon

v4.7.6-ls14

Mastodon is a free, open-source social network server based on ActivityPub where users can follow friends and discover new ones..

docker pull ghcr.io/linuxserver-playground/mastodon:latest

Quick start · configure#

Pick the optional settings and mods you want, set your paths, ports and values, then copy the result.

Image
Identity

The user the application runs as and its timezone.

Required
This is the unique identifier of your server in the network. It cannot be safely changed later.
Redis server hostname
Redis port
Postgres database hostname
Postgres username
Postgres db name
Postgres password
Postgres port
Enable or disable Elasticsearch (requires a separate ES instance)
Primary key for Active Record Encryption (opens in a new tab).
Deterministic key for Active Record Encryption (opens in a new tab).
Derivation salt for Active Record Encryption (opens in a new tab).
Browser session secret. Changing it will break all active browser sessions.
MFA secret. Changing it after initial setup will break two-factor authentication.
Push notification private key. Changing it after initial setup will break push notifications.
Push notification public key. Changing it after initial setup will break push notifications.
SMTP server for email notifications
SMTP server port
SMTP username
SMTP password
From address for emails send from Mastodon
Enable or disable S3 storage of uploaded files
Contains all relevant configuration files.
Port for web frontend
Port for web frontend
Optional settings17

Tick what you need; it is added to every output with its value.

Mods

0 for mastodon, 0 universal mods suggested for it, and 13 other universal mods. Ticked mods join one DOCKER_MODS value in the order you tick them.

---
services:
  mastodon:
    image: ghcr.io/linuxserver-playground/mastodon:latest
    container_name: mastodon
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - LOCAL_DOMAIN=example.com
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - DB_HOST=db
      - DB_USER=mastodon
      - DB_NAME=mastodon
      - DB_PASS=mastodon
      - DB_PORT=5432
      - ES_ENABLED=false
      - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=
      - ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=
      - ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=
      - SECRET_KEY_BASE=
      - OTP_SECRET=
      - VAPID_PRIVATE_KEY=
      - VAPID_PUBLIC_KEY=
      - SMTP_SERVER=mail.example.com
      - SMTP_PORT=25
      - SMTP_LOGIN=
      - SMTP_PASSWORD=
      - SMTP_FROM_ADDRESS=notifications@example.com
      - S3_ENABLED=false
    volumes:
      - /path/to/mastodon/config:/config
    ports:
      - 80:80
      - 443:443
    restart: unless-stopped

Required settings only. Tick optional settings and mods to add them.

  • Replace the /path/to folders with real folders on your host; they are created if missing.
  • Values flagged as secrets are masked here and left out of the shareable link.

Install on …

Adding a store to your platform

Version tags#

TagLatest buildBuiltTests
:latestStable releases.branch main · stablev4.7.6-ls14amd64 · arm64–
:developPre-releases *only*.branch develop · prereleasedevelop-v4.7.0-rc.1-ls5amd64 · arm64–
:glitch[glitch-soc](https://github.com/glitch-soc/mastodon) fork releases.branch glitch · prereleaseglitch-v4.7.6-ls13amd64 · arm64–

Architectures#

Pulling :latest picks the right one for your host automatically.

  • x86_64amd64-latest
  • arm64arm64v8-latest

Inside the latest image#

ghcr.io/linuxserver-playground/mastodon:v4.7.6-ls14

Explore this build
Base image
ghcr.io/linuxserver-playground/baseimage-alpine-nginx:3.24
Upstream version
v4.7.6
amd64 compressed
243 MB · 11 layers
arm64 compressed
239 MB · 11 layers
amd64 packages
855 · Alpine Linux v3.24
arm64 packages
856 · Alpine Linux v3.24
Tests
not run
Built
Reason
weekly package check

In the fleet#

Live branches, their latest release, upstream version and next scheduled check.

mastodon on the fleet board

live branchesloading…

Branch → tagLast buildReleasedUpstreamDriftNext checkFlags
develop → :developsuccess
v4.7.0-rc.1
? unknown––
glitch → :glitchsuccess
v4.7.6
? unknown––
main → :latestsuccess
v4.7.6
? unknown––

Application setup#

We provide aliases for the common commands that execute in the correct context so that environment variables from secrets are available to them:

  • To generate keys for SECRET_KEY_BASE & OTP_SECRET run docker run --rm -it --entrypoint /bin/bash lscr.io/linuxserver/mastodon:latest generate-secret once for each.

  • To generate keys for VAPID_PRIVATE_KEY & VAPID_PUBLIC_KEY run docker run --rm -it --entrypoint /bin/bash lscr.io/linuxserver/mastodon:latest generate-vapid

  • To generate keys for ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY, ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT, & ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY run docker run --rm -it --entrypoint /bin/bash lscr.io/linuxserver/mastodon:latest generate-active-record

Both of the secret generation aliases above can be run without any other setup having been carried out.

  • To use tootctl you can run something like docker exec -it lscr.io/linuxserver/mastodon /tootctl <command>

Using tootctl requires you to complete the initial Mastodon configuration first.

This container requires separate postgres and redis instances to run.

We support all of the official environment variables for configuration. In place of adding them all to your run/compose you can use an env file such as this example from the upstream project.

For more information check out the mastodon documentation.

Running separate sidekiq instances

It is currently only supported to run a single queue per container instance or all queues in a single container instance.

All containers must share the same /config mount and be on a common docker network.

NO_CHOWN Option

On larger Mastodon instances, our init process to verify that permissions are set correctly can noticeably slow down the container startup. If you are experiencing this, you can set NO_CHOWN to true to skip that step of the init.

Do NOT set this on first run of the container. If you enable this option you are taking full responsibility for ensuring that the permissions in your /config mount are correct. If you’re even slightly unsure, don’t set it.

Strict reverse proxies

This image automatically redirects to https with a self-signed certificate. If you are using a reverse proxy which validates certificates, you need to disable this check for the container.

Parameters#

Ports#
PortFunctionRequired
80:80Port for web frontendrequired
443:443Port for web frontendrequired
9394:9394Port for Prometheus metricsoptional
Environment variables#
VariableFunctionRequired
PUID=1000User IDrequired
PGID=1000Group IDrequired
TZ=Etc/UTCTimezonerequired
LOCAL_DOMAIN=example.comThis is the unique identifier of your server in the network. It cannot be safely changed later.required
REDIS_HOST=redisRedis server hostnamerequired
REDIS_PORT=6379Redis portrequired
DB_HOST=dbPostgres database hostnamerequired
DB_USER=mastodonPostgres usernamerequired
DB_NAME=mastodonPostgres db namerequired
DB_PASS=mastodonPostgres passwordrequired
DB_PORT=5432Postgres portrequired
ES_ENABLED=falseEnable or disable Elasticsearch (requires a separate ES instance)required
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=Primary key for Active Record Encryption (opens in a new tab).required
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=Deterministic key for Active Record Encryption (opens in a new tab).required
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=Derivation salt for Active Record Encryption (opens in a new tab).required
SECRET_KEY_BASE=Browser session secret. Changing it will break all active browser sessions.required
OTP_SECRET=MFA secret. Changing it after initial setup will break two-factor authentication.required
VAPID_PRIVATE_KEY=Push notification private key. Changing it after initial setup will break push notifications.required
VAPID_PUBLIC_KEY=Push notification public key. Changing it after initial setup will break push notifications.required
SMTP_SERVER=mail.example.comSMTP server for email notificationsrequired
SMTP_PORT=25SMTP server portrequired
SMTP_LOGIN=SMTP usernamerequired
SMTP_PASSWORD=SMTP passwordrequired
SMTP_FROM_ADDRESS=notifications@example.comFrom address for emails send from Mastodonrequired
S3_ENABLED=falseEnable or disable S3 storage of uploaded filesrequired
WEB_DOMAIN=mastodon.example.comThis can be set if you want your server identifier to be different to the subdomain hosting Mastodon. See https://docs.joinmastodon.org/admin/config/#basic (opens in a new tab)optional
ES_HOST=esElasticsearch server hostnameoptional
ES_PORT=9200Elasticsearch portoptional
ES_USER=elasticElasticsearch usernameoptional
ES_PASS=elasticElasticsearch passwordoptional
S3_BUCKET=S3 bucket hostnameoptional
AWS_ACCESS_KEY_ID=S3 bucket access key IDoptional
AWS_SECRET_ACCESS_KEY=S3 bucket secret access keyoptional
S3_ALIAS_HOST=Alternate hostname for object fetching if you are front the S3 connections.optional
SIDEKIQ_ONLY=falseOnly run the sidekiq service in this container instance. For large scale instances that need better queue handling.optional
SIDEKIQ_QUEUE=The name of the sidekiq queue to run in this container. See notes (opens in a new tab).optional
SIDEKIQ_DEFAULT=falseSet to true on the main container if you're running additional sidekiq instances. It will run the default queue.optional
SIDEKIQ_THREADS=5The number of threads for sidekiq to use. See notes (opens in a new tab).optional
DB_POOL=5The size of the DB connection pool, must be at least the same as SIDEKIQ_THREADS. See notes (opens in a new tab).optional
NO_CHOWN=Set to true to skip chown of /config on init. READ THE APPLICATION NOTES BEFORE SETTING THIS.optional
MASTODON_PROMETHEUS_EXPORTER_ENABLED=If set to true, Mastodon’s Ruby processes (web & Sidekiq) will enable the Prometheus instrumentation.optional
Volumes#
PathFunctionRequired
/configContains all relevant configuration files.required

Environment variables from files (Docker secrets)#

You can set any environment variable from a file by using a special prepend FILE__.

As an example:

-e FILE__MYVAR=/run/secrets/mysecretvariable

Will set the environment variable MYVAR based on the contents of the /run/secrets/mysecretvariable file.

Umask for running applications#

For all of our images we provide the ability to override the default umask settings for services started within the containers using the optional -e UMASK=022 setting. Keep in mind umask is not chmod it subtracts from permissions based on it’s value it does not add. Please read up here before asking for support.

User / Group Identifiers#

When using volumes (-v flags), permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user PUID and group PGID.

Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.

In this instance PUID=1000 and PGID=1000, to find yours use id your_user as below:

id your_user

Example output:

uid=1000(your_user) gid=1000(your_user) groups=1000(your_user)

Updating Info#

Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (noted in the relevant readme.md), we do not recommend or support updating apps inside the container. Please consult the Application Setup section above to see if it is recommended for the image.

Below are the instructions for updating containers:

Via Docker Compose

  • Update images:

    • All images:

      docker-compose pull
    • Single image:

      docker-compose pull mastodon
  • Update containers:

    • All containers:

      docker-compose up -d
    • Single container:

      docker-compose up -d mastodon
  • You can also remove the old dangling images:

    docker image prune

Via Docker Run

  • Update the image:

    docker pull ghcr.io/linuxserver-playground/mastodon:latest
  • Stop the running container:

    docker stop mastodon
  • Delete the container:

    docker rm mastodon
  • Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your /config folder and settings will be preserved)

  • You can also remove the old dangling images:

    docker image prune

Image Update Notifications - Diun (Docker Image Update Notifier)

Tip

We recommend Diun for update notifications. Other tools that automatically update containers unattended are not recommended or supported.

Building locally#

If you want to make local modifications to these images for development purposes or just to customize the logic:

git clone https://github.com/linuxserver-playground/docker-mastodon.git
cd docker-mastodon
docker build \
  --no-cache \
  --pull \
  -t ghcr.io/linuxserver-playground/mastodon:latest .

The ARM variants can be built on x86_64 hardware and vice versa using ghcr.io/linuxserver/qemu-static

docker run --rm --privileged ghcr.io/linuxserver/qemu-static --reset

Once registered you can define the dockerfile to use with -f Dockerfile.aarch64.

Every push builds and tests the image with the shared workflow in linuxserver-playground/workflows; every build’s tests, screenshots and package changes are on the image’s builds on the website.

Builds#

The newest five builds per branch, each with its CI report; 21 older releases are on GitHub, listed below.

TagBuiltReasonChangeResultSize
v4.7.6-ls14main · 36d62f27weekly package checkbasesuccess243 MB amd64239 MB arm64
glitch-v4.7.6-ls13glitch · 44e183a7weekly package checkbasesuccess249 MB amd64245 MB arm64
v4.7.6-ls13main · f07d46e0weekly package checkbasesuccess243 MB amd64240 MB arm64
glitch-v4.7.6-ls12glitch · 4559af79weekly package checkbasesuccess252 MB amd64248 MB arm64
v4.7.6-ls12main · 0f94b38fweekly package checkbasesuccess246 MB amd64243 MB arm64
glitch-v4.7.6-ls11glitch · af57c49dupstream checkmixedsuccess252 MB amd64248 MB arm64
v4.7.6-ls11main · 3baab6b1upstream checkmixedsuccess246 MB amd64243 MB arm64
glitch-v4.7.5-ls10glitch · 5f91886bweekly package checkbasesuccess252 MB amd64248 MB arm64
v4.7.5-ls10main · 30abaaf3weekly package checkpackagessuccess243 MB amd64240 MB arm64
glitch-v4.7.5-ls9glitch · 1e608136weekly package checkbasesuccess249 MB amd64245 MB arm64
develop-v4.7.0-rc.1-ls5develop · 26d5d248weekly package checkbasesuccess243 MB amd64239 MB arm64
develop-v4.7.0-rc.1-ls4develop · 83baa7b3release check or requested rebuildbasesuccess243 MB amd64239 MB arm64
develop-v4.7.0-rc.1-ls3develop · 04ae8a58push to the branchbasesuccess243 MB amd64239 MB arm64
develop-v4.7.0-rc.1-ls2develop · 839a1605push to the branchmixedsuccess243 MB amd64239 MB arm64
develop-v4.7.0-rc.1-ls1develop · 71d40f09upstream checkinitialsuccess244 MB amd64240 MB arm64
Older releases21Release, run record and run on GitHub
Older releases of mastodon, without a page on this site
TagBuiltLinks
v4.7.5-ls9mainRelease v4.7.5-ls9 on GitHub (opens in a new tab)run.json of v4.7.5-ls9Run that built v4.7.5-ls9, on GitHub (opens in a new tab)
glitch-v4.7.5-ls8glitchRelease glitch-v4.7.5-ls8 on GitHub (opens in a new tab)run.json of glitch-v4.7.5-ls8Run that built glitch-v4.7.5-ls8, on GitHub (opens in a new tab)
v4.7.5-ls8mainRelease v4.7.5-ls8 on GitHub (opens in a new tab)run.json of v4.7.5-ls8Run that built v4.7.5-ls8, on GitHub (opens in a new tab)
glitch-v4.7.5-ls7glitchRelease glitch-v4.7.5-ls7 on GitHub (opens in a new tab)run.json of glitch-v4.7.5-ls7Run that built glitch-v4.7.5-ls7, on GitHub (opens in a new tab)
v4.7.5-ls7mainRelease v4.7.5-ls7 on GitHub (opens in a new tab)run.json of v4.7.5-ls7Run that built v4.7.5-ls7, on GitHub (opens in a new tab)
glitch-v4.7.5-ls6glitchRelease glitch-v4.7.5-ls6 on GitHub (opens in a new tab)run.json of glitch-v4.7.5-ls6Run that built glitch-v4.7.5-ls6, on GitHub (opens in a new tab)
v4.7.5-ls6mainRelease v4.7.5-ls6 on GitHub (opens in a new tab)run.json of v4.7.5-ls6Run that built v4.7.5-ls6, on GitHub (opens in a new tab)
glitch-v4.7.5-ls5glitchRelease glitch-v4.7.5-ls5 on GitHub (opens in a new tab)run.json of glitch-v4.7.5-ls5Run that built glitch-v4.7.5-ls5, on GitHub (opens in a new tab)
v4.7.5-ls5mainRelease v4.7.5-ls5 on GitHub (opens in a new tab)run.json of v4.7.5-ls5Run that built v4.7.5-ls5, on GitHub (opens in a new tab)
glitch-v4.7.4-ls5glitchRelease glitch-v4.7.4-ls5 on GitHub (opens in a new tab)run.json of glitch-v4.7.4-ls5Run that built glitch-v4.7.4-ls5, on GitHub (opens in a new tab)
v4.7.4-ls5mainRelease v4.7.4-ls5 on GitHub (opens in a new tab)run.json of v4.7.4-ls5Run that built v4.7.4-ls5, on GitHub (opens in a new tab)
v4.7.4-ls4mainRelease v4.7.4-ls4 on GitHub (opens in a new tab)run.json of v4.7.4-ls4Run that built v4.7.4-ls4, on GitHub (opens in a new tab)
glitch-v4.7.4-ls4glitchRelease glitch-v4.7.4-ls4 on GitHub (opens in a new tab)run.json of glitch-v4.7.4-ls4Run that built glitch-v4.7.4-ls4, on GitHub (opens in a new tab)
glitch-v4.7.4-ls3glitchRelease glitch-v4.7.4-ls3 on GitHub (opens in a new tab)run.json of glitch-v4.7.4-ls3Run that built glitch-v4.7.4-ls3, on GitHub (opens in a new tab)
glitch-v4.4.27-ls3glitchRelease glitch-v4.4.27-ls3 on GitHub (opens in a new tab)run.json of glitch-v4.4.27-ls3Run that built glitch-v4.4.27-ls3, on GitHub (opens in a new tab)
v4.7.4-ls3mainRelease v4.7.4-ls3 on GitHub (opens in a new tab)run.json of v4.7.4-ls3Run that built v4.7.4-ls3, on GitHub (opens in a new tab)
glitch-v4.7.3-ls3glitchRelease glitch-v4.7.3-ls3 on GitHub (opens in a new tab)run.json of glitch-v4.7.3-ls3Run that built glitch-v4.7.3-ls3, on GitHub (opens in a new tab)
glitch-v4.7.3-ls2glitchRelease glitch-v4.7.3-ls2 on GitHub (opens in a new tab)run.json of glitch-v4.7.3-ls2Run that built glitch-v4.7.3-ls2, on GitHub (opens in a new tab)
v4.7.3-ls2mainRelease v4.7.3-ls2 on GitHub (opens in a new tab)run.json of v4.7.3-ls2Run that built v4.7.3-ls2, on GitHub (opens in a new tab)
glitch-v4.7.3-ls1glitchRelease glitch-v4.7.3-ls1 on GitHub (opens in a new tab)run.json of glitch-v4.7.3-ls1Run that built glitch-v4.7.3-ls1, on GitHub (opens in a new tab)
v4.7.3-ls1mainRelease v4.7.3-ls1 on GitHub (opens in a new tab)run.json of v4.7.3-ls1Run that built v4.7.3-ls1, on GitHub (opens in a new tab)

Mods#

Add a mod with DOCKER_MODS=<image>; separate several with |.

All mods for mastodon

No mod targets mastodon specifically; the 13 universal mods work with every image.

Reverse proxy#

mastodon listens on http://mastodon:80.

What you named the mastodon container; SWAG resolves it on the shared network.

Uncomments the matching include lines; API locations stay open so client apps keep working.

  • Save as /config/nginx/proxy-confs/mastodon.subdomain.conf in SWAG (drop the .sample) and restart SWAG.
  • Your DNS needs a record for mastodon.yourdomain.com (a CNAME to the domain, or a wildcard), and SWAG's SUBDOMAINS must cover it.
  • The mastodon container and SWAG must share a user-defined Docker network so the name resolves.
## Version 2026/11/28
# make sure that your mastodon container is named mastodon
# make sure that your dns has a cname set for mastodon

server {
    listen 443 ssl;
#    listen 443 quic;
    listen [::]:443 ssl;
#    listen [::]:443 quic;

    server_name mastodon.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth (requires ldap-location.conf in the location block)
    #include /config/nginx/ldap-server.conf;

    # enable for Authelia (requires authelia-location.conf in the location block)
    #include /config/nginx/authelia-server.conf;

    # enable for Authentik (requires authentik-location.conf in the location block)
    #include /config/nginx/authentik-server.conf;

    # enable for Tinyauth (requires tinyauth-location.conf in the location block)
    #include /config/nginx/tinyauth-server.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable for ldap auth (requires ldap-server.conf in the server block)
        #include /config/nginx/ldap-location.conf;

        # enable for Authelia (requires authelia-server.conf in the server block)
        #include /config/nginx/authelia-location.conf;

        # enable for Authentik (requires authentik-server.conf in the server block)
        #include /config/nginx/authentik-location.conf;

        # enable for Tinyauth (requires tinyauth-server.conf in the server block)
        #include /config/nginx/tinyauth-location.conf;

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app mastodon;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }
}

Default sample.

Source: linuxserver-playground.github.io/hub/api/v1/catalog/mastodon/proxy.json

Changelog#

  1. Rebase to Alpine 3.24.

  2. Add prometheus exporter support.

  3. Add vips-heif.

  4. Rebase to Alpine 3.22.

  5. Rebase to Alpine 3.21, replace deprecated imagemagick with vips.

  6. Rebase to Alpine 3.20, enable Active Record Encryption (opens in a new tab). Existing users should update their nginx confs to avoid http2 deprecation warnings.

  7. Rebase to Alpine 3.18, migrate to s6v3.

  8. Adjust apk flags.

4 earlier entries
  1. Add Glitch branch.
  2. Updated nginx conf to fix bring inline with Mastodon configuration (fixes Elk integration).
  3. Support separate sidekiq queue instances.
  4. Initial Release.

Support#

Questions about running mastodon? Start with the documentation and the community; open an issue for bugs.

  • Shell access whilst the container is running:

    docker exec -it mastodon /bin/bash
  • To monitor the logs of the container in realtime:

    docker logs -f mastodon
  • Container version number:

    docker inspect -f '{{ index .Config.Labels "build_version" }}' mastodon
  • Image version number:

    docker inspect -f '{{ index .Config.Labels "build_version" }}' ghcr.io/linuxserver-playground/mastodon:latest

Community project

Improve mastodon

This image is kept up by volunteers, and you can be one of them. You don't need to know how the pipeline works: point an AI agent at the harness and describe what you want. It reproduces the problem in your Docker, tests the change and drafts the pull request for you to check.

Ask your agent

  • Something is wrong with the mastodon image: <what you saw>. Reproduce it, fix it and draft the PR.
  • Add <package> to the mastodon image, test it and draft the PR.
  • Make a mod for mastodon that <what you need>, and test it.

Contributing an image Every way to help Get the harness (opens in a new tab)

Related

Browse all

ferdium

v7.2.3-ls9

Ferdium is a desktop app that helps you organize how you use your favourite apps by combining them into one application.

0 GitHub starsselkiesarm64