CONTAINER HARDENING

How to Deploy Mornye Using
Rootless Docker Compose

Author: NavyaXdev • Topic: Hardened Containerization • Read Time: 10 min

Containerizing storage applications introduces significant architectural risks. Many off-the-shelf container images execute as root (UID: 0), share root filesystem namespaces with the host, and rely on sweeping permission modifications (such as chmod 777) to bypass permission errors. If a remote exploit or path traversal vulnerability affects such a container, the attacker immediately gains root-level access over the host system.

Mornye Network Storage enforces a strict rootless container model. The container executes under an unprivileged user (UID: 1000, GID: 1000), drops all Linux capabilities, and isolates storage mounts using POSIX permissions.

1. Rootless Security Posture

UID 1000 NON-ROOT

Explicit Unprivileged User

User mornye is assigned UID 1000 / GID 1000. No process ever runs as UID 0 after image build.

KERNEL SECURITY

Capabilities Dropped

cap_drop: ALL strips all Linux capabilities, blocking raw device access, module loading, and interface tampering.

NO ESCALATION

No New Privileges

no-new-privileges: true prevents setuid binaries within container layers from escalating privilege flags.

VOLUME ISOLATION

Stateless Container Root

State and data are directed exclusively into mounted volumes (/data, /storage, /logs).

2. Production Compose Specification (compose.yaml)

yaml — compose.yaml
services:
  mornye-webdav:
    build:
      context: .
      dockerfile: Dockerfile
    image: mornye-webdav:latest
    container_name: mornye-webdav
    restart: unless-stopped
    user: "1000:1000"
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    ports:
      - "127.0.0.1:${MORNYE_HOST_PORT:-8001}:8000"
    volumes:
      - ./database:/data
      - ./storage:/storage
      - ./logs:/logs
    environment:
      - MORNYE_PORT=8000
      - MORNYE_STORAGE_ROOT=/storage
      - MORNYE_DB_PATH=/data/mornye.db
      - MORNYE_LOG_PATH=/logs/mornye.log
      - MORNYE_AUTH_ENABLED=${MORNYE_AUTH_ENABLED:-true}
      - MORNYE_AUTH_USER=${MORNYE_AUTH_USER:-admin}
      - MORNYE_AUTH_HASH=${MORNYE_AUTH_HASH}
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

3. Host Directory Permissions & The UID 1000 Rule

Because the container process runs with UID 1000, host directories must be writable by UID 1000. Set permissions on your host filesystem prior to launching the container:

bash — host-permissions
# Ensure persistent directories exist
mkdir -p database storage logs backups config

# Assign ownership to UID:GID 1000:1000
sudo chown -R 1000:1000 database storage logs backups config

# Secure permissions to user-only access
chmod 700 database storage logs backups config
Automatic Diagnostic Healing:

If permissions ever drift, run ./mornye.sh doctor --fix. Mornye's diagnostic engine automatically identifies permission mismatches and applies correct ownership with a pre-change safety snapshot.

4. Container Lifecycle & Hot SQLite Backups

bash — lifecycle-commands
# Build and start container in detached mode
docker compose up -d --build

# Verify container process status and health
docker compose ps

# Follow live WebDAV access & daemon logs
docker compose logs -f mornye-webdav

# Create hot online backup of SQLite database without stopping service
./mornye.sh backup create

Ready to Launch?

Deploy rootless Docker storage automatically with our 2-minute installation wizard.

View Installation Guide → Docker Overview Page