How to Self-Host Friendica with Docker Compose

A Facebook-Shaped Hole in the Fediverse

Most fediverse platforms replicate Twitter’s short-post format. Friendica takes a different path — it’s built around long-form posts, photo albums, events, groups, and the kind of multi-format social experience Facebook provides. It federates via ActivityPub (Mastodon, Pleroma, Misskey), Diaspora, and OStatus simultaneously, making it one of the most protocol-versatile platforms in the decentralized social web. Official site

Friendica started as “Mistpark” in 2010, making it one of the oldest actively maintained fediverse projects. It’s PHP-based, runs on Apache or Nginx, and uses MariaDB/MySQL for storage. The Docker deployment simplifies what would otherwise be a manual LAMP stack setup.

FeatureDetails
Protocol SupportActivityPub, Diaspora, OStatus
LicenseAGPL-3.0
LanguagePHP
Latest Stable2026.01 (“Blutwurz”)
Web UIBuilt-in (multiple themes)
Mobile AppFedilab, Friendica-compatible clients
FederationFull (Mastodon, Pleroma, Misskey, Diaspora, Hubzilla)

Prerequisites

  • A Linux server (Ubuntu 22.04+ recommended)
  • Docker and Docker Compose installed (guide)
  • 1 GB RAM minimum (2 GB recommended)
  • 10 GB of free disk space
  • A domain name with DNS configured
  • SMTP credentials for sending email notifications (optional but recommended)
RequirementMinimumRecommended
RAM1 GB2 GB
CPU1 core2 cores
Disk5 GB20 GB+
NetworkDomain with HTTPSDomain + reverse proxy

Docker Compose Configuration

Create a project directory:

mkdir -p /opt/friendica && cd /opt/friendica

Create a db.env file with your database credentials:

MYSQL_USER=friendica
MYSQL_PASSWORD=change-this-strong-password
MYSQL_DATABASE=friendica

Create a docker-compose.yml file:

services:
  db:
    image: mariadb:11.4
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/mysql
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
    env_file:
      - db.env
    networks:
      - friendica-net
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 30s
      timeout: 10s
      retries: 5

  redis:
    image: redis:7.4-alpine
    restart: unless-stopped
    volumes:
      - redis-data:/data
    networks:
      - friendica-net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 30s
      timeout: 5s
      retries: 3

  app:
    image: friendica:2026.01-apache
    restart: unless-stopped
    volumes:
      - friendica-data:/var/www/html
    environment:
      FRIENDICA_ADMIN_MAIL: [email protected]    # Admin account email
      FRIENDICA_TZ: UTC                              # Server timezone
      FRIENDICA_LANG: en                             # Default language
      FRIENDICA_URL: https://social.yourdomain.com   # Full URL with protocol
      FRIENDICA_SITENAME: My Friendica               # Instance name
      MYSQL_HOST: db                                 # Database service name
      REDIS_HOST: redis                              # Redis service name
    env_file:
      - db.env
    ports:
      - "8080:80"
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - friendica-net

  cron:
    image: friendica:2026.01-apache
    restart: unless-stopped
    volumes:
      - friendica-data:/var/www/html
    entrypoint: /cron.sh
    environment:
      MYSQL_HOST: db
      REDIS_HOST: redis
    env_file:
      - db.env
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - friendica-net

volumes:
  db-data:
  redis-data:
  friendica-data:

networks:
  friendica-net:

Start the stack:

docker compose up -d

The first startup takes 1-2 minutes while Friendica initializes the database schema and downloads dependencies.

Initial Setup

  1. Open http://your-server-ip:8080 in your browser
  2. Friendica auto-configures using the environment variables you set — the database connection, admin email, and site URL are pre-populated
  3. Register your admin account using the email address you specified in FRIENDICA_ADMIN_MAIL
  4. Log in and navigate to Admin → Site to verify your instance settings

The admin account is the first account registered that matches the FRIENDICA_ADMIN_MAIL address. Other accounts registered with different emails get regular user privileges.

Configuration

Essential Settings

In Admin → Site, configure:

  • Registration policy: Open, approval-required, or closed
  • Max image size: Default is 800KB — increase for photo-heavy usage
  • Allowed HTML tags: Controls what formatting users can use in posts
  • Directory URL: Set to https://dir.friendi.ca for global discovery

Addon Management

Navigate to Admin → Addons to enable:

  • LDAP/AD authentication: For SSO integration
  • Diaspora connector: Federate with Diaspora pods
  • OStatus connector: Legacy federation protocol
  • Two-factor authentication: TOTP-based 2FA for user accounts
  • CalDAV/CardDAV: Calendar and contact sync

Email Integration

For notifications and password resets, add SMTP settings to your docker-compose.yml app service:

environment:
  SMTP: smtp.yourdomain.com
  SMTP_PORT: 587
  SMTP_AUTH_USER: your-smtp-user
  SMTP_AUTH_PASS: your-smtp-password
  SMTP_AUTH_METHOD: PLAIN

Advanced Configuration

PHP Tuning

Mount a custom php.ini for large instances:

volumes:
  - ./custom-php.ini:/usr/local/etc/php/conf.d/custom.ini:ro

Create custom-php.ini:

upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 512M
max_execution_time = 300

Federation Relay

To improve content discovery, connect to a relay:

  1. Go to Admin → Site → Relay server
  2. Enter a relay URL (e.g., https://relay.intahnet.co.uk)
  3. Select the tags you want to follow

This pulls public posts from across the fediverse into your instance’s public timeline, making it feel active even with few local users.

Reverse Proxy

Friendica requires HTTPS for federation. Use a reverse proxy in front of port 8080.

Nginx Proxy Manager

Set up a proxy host:

  • Domain: social.yourdomain.com
  • Forward hostname: localhost (or your server IP)
  • Forward port: 8080
  • SSL: Request a new certificate with Let’s Encrypt

For manual Nginx config, see our Reverse Proxy Setup guide.

Caddy

social.yourdomain.com {
    reverse_proxy localhost:8080
}

Backup

What to Back Up

DataLocationPriority
Databasedb-data volumeCritical
Uploaded filesfriendica-data volume (/var/www/html/)Critical
Environment filesdb.env, docker-compose.ymlImportant
Redis cacheredis-data volumeLow (rebuilds automatically)

Backup Commands

# Database dump
docker compose exec db mariadb-dump -u friendica -p friendica > friendica-backup-$(date +%Y%m%d).sql

# Volume backup
docker run --rm -v friendica-data:/data -v $(pwd):/backup alpine \
  tar czf /backup/friendica-files-$(date +%Y%m%d).tar.gz -C /data .

For automated backup strategies, see our Backup Strategy guide.

Troubleshooting

Cron Not Running (Federation Stalls)

Symptom: Posts from other instances stop appearing. Outgoing posts aren’t delivered.

Fix: Verify the cron container is running:

docker compose logs cron

The cron container runs Friendica’s worker process every few minutes. If it’s restarting in a loop, check that db.env is readable and database credentials match.

Admin Account Not Created

Symptom: You registered but don’t have admin privileges.

Fix: The admin account must use the exact email specified in FRIENDICA_ADMIN_MAIL. If you used a different email, update the environment variable, restart the app container, and register a new account with the correct email.

docker compose down && docker compose up -d

Federation Not Working

Symptom: Can’t follow accounts on other instances. Remote profiles show errors.

Fix: Verify:

  1. FRIENDICA_URL matches your actual domain (including https://)
  2. HTTPS is properly configured through your reverse proxy
  3. Port 443 is reachable from the internet
  4. The cron container is running (federation happens in background jobs)

High Memory Usage

Symptom: The app container uses excessive RAM after running for days.

Fix: Friendica’s PHP processes can accumulate memory. Schedule a weekly container restart:

# Add to host crontab
0 4 * * 0 cd /opt/friendica && docker compose restart app cron

Images Not Loading

Symptom: Uploaded images return 404 or broken image icons.

Fix: Check volume permissions. The friendica-data volume must be writable by the web server user (www-data, UID 33):

docker compose exec app chown -R www-data:www-data /var/www/html/

Resource Requirements

MetricIdleUnder Load
RAM~250 MB~600 MB
CPULowMedium (during federation)
Disk500 MB (app)Grows with media uploads
Database~100 MB initialGrows with posts/contacts

With Redis, federation processing is noticeably faster and memory usage stays more stable. The cron container adds minimal overhead (~50 MB).

Verdict

If you want a fediverse presence that goes beyond microblogging, Friendica is the right tool. It handles long-form posts, events, photo albums, and group discussions in a way that Mastodon, Pleroma, and GoToSocial simply don’t attempt. The multi-protocol federation (ActivityPub + Diaspora + OStatus) means you can interact with more of the decentralized web than any other single platform.

The trade-off is resource usage and complexity — four containers (app, db, redis, cron) vs GoToSocial’s single binary. And the UI shows its age compared to Mastodon or Misskey. But for replacing Facebook-style social networking with something you control, Friendica is the only serious self-hosted option.

FAQ

Can I migrate from Mastodon to Friendica?

You can redirect followers using ActivityPub account migration, but post history doesn’t transfer. Friendica supports the standard Move activity, so followers on Mastodon instances will automatically re-follow your new Friendica account.

Does Friendica support groups?

Yes. Friendica has built-in forum/group functionality. Create a “forum” account type, and any post mentioning that account becomes a group discussion visible to all followers. This is a feature most other fediverse platforms lack.

How many users can one instance handle?

A 2 GB RAM server can comfortably handle 50-100 active users. Beyond that, tune PHP-FPM worker counts and consider the FPM variant with a dedicated Nginx container for better concurrency.

Is there a mobile app?

There’s no dedicated Friendica mobile app, but Fedilab (Android) has native Friendica support. The web UI is also responsive and works on mobile browsers.

Can I use Friendica with SSO?

Yes, via the LDAP addon. It supports LDAP, Active Directory, and can integrate with identity providers like Authentik or Authelia through LDAP backend.

Comments