Skip to content

Run MeManga in Docker ​

The Docker image runs the memanga command line in a container: on a home server, a NAS or any machine with Docker. It does not contain the desktop app.

This page assumes you know how to run a container. For the commands themselves see Use the command line.

Two different images

  • The published image is built from release v0.5.0. It is what docker pull gives you.
  • An image you build from the source code has the development version.

Each section says when it is about only one of them.

The published image ​

The same image is published in two places:

  • Docker Hub: meellm/memanga
  • GitHub Container Registry: ghcr.io/meellm/memanga
TagWhat it is
0.5.0Release v0.5.0. Does not change.
0.5The newest 0.5 release. Today the same as 0.5.0.
latestThe newest release. Today the same as 0.5.0.

For a setup that runs unattended, use a full version such as 0.5.0, so that an update happens when you decide.

sh
docker pull meellm/memanga:0.5.0

Systems: Linux on amd64 (most PCs and servers) and arm64 (for example a 64-bit Raspberry Pi). There is no image for 32-bit ARM.

Size: the download is large, and unpacked on disk the image takes more space. To see its size on your machine after the pull:

sh
docker image ls meellm/memanga

Why it is large: the image contains two browsers, Firefox and Chromium, with the system libraries they need. MeManga uses them for sources that do not work without a real browser; Chromium is there for sources that block Firefox. An image with one browser does not exist yet: see Planned.

Keep your data ​

A container is thrown away after each run. Your settings, your library and your downloaded chapters live in two folders that you must keep outside it:

  • /home/memanga/.config/memanga holds config.yaml and state.json: your settings, your library and the download history.
  • /home/memanga/Downloads/MeManga holds the downloaded chapters.

Named volumes ​

The simplest way, and the one to start with. Docker creates the volumes on first use and keeps them until you remove them:

sh
docker run --rm --init \
  -v memanga-config:/home/memanga/.config/memanga \
  -v memanga-downloads:/home/memanga/Downloads/MeManga \
  meellm/memanga:0.5.0 list

Everything on this page uses this command. Only the last part changes: list here, status or check --auto elsewhere.

  • --rm removes the container after the run. The named volumes stay.
  • --init is explained under Stopping.
  • New named volumes need no preparation.

Folders on your machine ​

To have the chapters in a normal folder, you can give a path instead of a volume name. This needs more care, because of who may write to the folder.

MeManga runs in the container as a user with the ID 1000, not as root. A folder from your machine keeps the owner and permissions it has there, so it must be writable for user ID 1000.

Use two new, empty folders made only for MeManga. Do not point MeManga at a folder that already holds other files, such as your whole downloads folder or your home folder.

  1. Create the folders. Replace CONFIG-DIR and DOWNLOADS-DIR with full paths of folders that do not exist yet:

    sh
    mkdir -p "CONFIG-DIR" "DOWNLOADS-DIR"
  2. Check your own user ID:

    sh
    id -u

    If it prints 1000, the folders you just created already belong to the right ID. Go to step 4.

  3. Otherwise, give these two new folders to ID 1000. This changes the owner of the two folders only, and you may need administrator rights for it:

    sh
    chown 1000:1000 "CONFIG-DIR" "DOWNLOADS-DIR"
  4. Run MeManga with the folders:

    sh
    docker run --rm --init \
      -v "CONFIG-DIR:/home/memanga/.config/memanga" \
      -v "DOWNLOADS-DIR:/home/memanga/Downloads/MeManga" \
      meellm/memanga:0.5.0 list

Things to know:

  • Files that MeManga creates in these folders belong to user ID 1000 on your machine. If that is not you, you can read them only as far as their permissions allow.
  • Do not change the owner of an existing folder and everything in it to make MeManga work. That can take files away from you or from other programs. Start with new folders instead.
  • Giving access through a shared group or an access-control list also works in principle. It depends on your system and is not covered here.
  • With rootless Docker, Podman or user-namespace remapping, ID 1000 inside the container is a different ID on your machine, and the steps above do not fit. Use named volumes there.

Run commands ​

Commands that ask questions ​

Some commands ask questions, for example memanga config. They need a terminal, which Docker only provides with -it:

sh
docker run --rm --init -it \
  -v memanga-config:/home/memanga/.config/memanga \
  -v memanga-downloads:/home/memanga/Downloads/MeManga \
  meellm/memanga:0.5.0 config

Without -it such a command cannot ask and does not do its work.

Commands without questions ​

Most everyday commands can be written so that they ask nothing. These work in the published image. Each is the last part of the command, with the same volumes as above:

  • add -t "TITLE" -u "SERIES-URL" adds a series.
  • list shows your library.
  • check --dry-run lists new chapters and downloads nothing.
  • check --auto downloads new chapters without asking.
  • status shows the settings.

Replace TITLE and SERIES-URL with your own values. check contacts the sources; check --auto downloads.

You can also change single settings without questions, for example config set delivery.output_format epub. The rules for running without a terminal are in Use MeManga in scripts.

Use Docker Compose ​

Compose saves you from typing the volumes each time. One file is enough; you do not need the source code.

  1. Make a new, empty folder and save this file in it as compose.yaml:
yaml
# Runs the published MeManga image. No copy of the source code is needed:
# this file alone is enough.
#
#   docker compose run --rm memanga list
#   docker compose run --rm memanga check --dry-run
#
# Settings, in a file named .env next to this one or in your shell:
#   MEMANGA_IMAGE  the image to run (default: the release pinned below)
#   TZ             time zone inside the container, for example
#                  Europe/Berlin (default: UTC)
#
# To build from the source code instead, with scheduled checks, use
# compose.dev.yaml.

services:
  # One-off commands: docker compose run --rm memanga <command>
  memanga:
    image: ${MEMANGA_IMAGE:-meellm/memanga:0.5.0}
    # Cleans up the helper processes that the browsers leave behind. The
    # image has this built in from 0.5.0; an older MEMANGA_IMAGE needs it.
    init: true
    environment:
      TZ: ${TZ:-UTC}
    volumes:
      - memanga-config:/home/memanga/.config/memanga
      - memanga-downloads:/home/memanga/Downloads/MeManga
    command: ["list"]

volumes:
  memanga-config:
  memanga-downloads:
  1. Run commands from that folder:

    sh
    docker compose run --rm memanga list
    docker compose run --rm memanga config
    docker compose run --rm memanga check --dry-run

What the file does:

  • It runs the published image meellm/memanga:0.5.0 and starts it with an init process, so --init is not needed here.
  • docker compose run connects the command to your terminal, so commands that ask questions work without -it.
  • It keeps your data in two named volumes. Compose puts the name of the folder in front of the volume names, so the data belongs to that folder: always run the commands from there. These are not the volumes of the docker run examples above.
  • It has no service that keeps running. For a schedule, see Check on a schedule.

Two settings are optional. Put them in a file named .env in the same folder, one per line:

sh
TZ=Europe/Berlin
MEMANGA_IMAGE=meellm/memanga:NEW-VERSION
  • TZ sets the time zone in the container. Without it the file uses UTC.
  • MEMANGA_IMAGE runs another image, for example a newer release. Without it the file uses 0.5.0.

Send to a Kindle ​

Email delivery works in a container as it does elsewhere: Send chapters to a Kindle explains the settings.

Enter the email settings with the config command above. The image has no usable system keyring, so the password is saved as plain text in config.yaml, in the config volume. Anyone who can read that volume can read the password.

You can keep the password out of the config volume and pass it in from outside. Put it in a file on your machine that only you can read, in this form:

sh
MEMANGA_SMTP_PASSWORD=YOUR-APP-PASSWORD

Then add --env-file "ENV-FILE" to the docker run command, with the path of that file. MEMANGA_SMTP_PASSWORD_FILE works too: it names a file inside the container that holds only the password; with Compose, see below. Set only one of the two variables: when both are set, MeManga uses neither.

A password file with Compose ​

These steps add the password file to compose.dev.yaml, described under Image built from source.

  1. Save the app password in a new file of its own, outside the source folder so that it is never committed. These commands stop if the file, or a link with that name, already exists. Otherwise they create it readable only by you and wait for the password: paste it, press Enter and then Ctrl-D.

    sh
    mkdir -p ~/memanga-secrets
    f=~/memanga-secrets/smtp_password
    if [ -e "$f" ] || [ -L "$f" ]; then
      echo "$f already exists; remove it or choose another name" >&2
    else
      ( umask 077; set -C; cat > "$f" )
    fi
  2. Compose mounts the file with the owner and permissions it has on your machine; the uid, gid and mode options of a secret do not change that for a file. MeManga reads it as the user with ID 1000 in the container. With Docker on Linux running as root, without user-namespace remapping, that is ID 1000 on your machine too, as under Folders on your machine. If id -u shows 1000 for you, nothing else is needed. Otherwise give this one file to ID 1000:

    sh
    sudo chown 1000 ~/memanga-secrets/smtp_password

    With rootless Docker or user-namespace remapping, the container's ID 1000 is a different ID on your machine; Docker's UID/GID mapping page explains how to find it.

  3. Save this as compose.secrets.yaml next to compose.dev.yaml:

    yaml
    services:
      memanga:
        environment:
          MEMANGA_SMTP_PASSWORD_FILE: /run/secrets/smtp_password
        secrets:
          - smtp_password
      scheduler:
        environment:
          MEMANGA_SMTP_PASSWORD_FILE: /run/secrets/smtp_password
        secrets:
          - smtp_password
    
    secrets:
      smtp_password:
        file: ${HOME}/memanga-secrets/smtp_password
  4. Name both files on every command, so the second one is added to the first:

    sh
    docker compose -f compose.dev.yaml -f compose.secrets.yaml run --rm memanga doctor
    docker compose -f compose.dev.yaml -f compose.secrets.yaml up -d scheduler

    If you use COMPOSE_FILE, list both: COMPOSE_FILE=compose.dev.yaml:compose.secrets.yaml, separated by ; instead of : on Windows.

With email delivery set up, doctor then reports on its keyring line that the app password comes from MEMANGA_SMTP_PASSWORD_FILE; a password still saved in config.yaml is reported there first. If the file cannot be read, MeManga does not fall back to a password saved earlier: sending fails, and the email line of doctor names the problem.

Check on a schedule ​

memanga cron install is for a normal installation. Do not use it in a container: no scheduler runs there, so nothing would ever start.

Published image: let your machine start it ​

Let the scheduler of your machine start a container when it is time. With cron on Linux, a line like this checks every day at 06:00:

sh
0 6 * * * docker run --rm --init -v memanga-config:/home/memanga/.config/memanga -v memanga-downloads:/home/memanga/Downloads/MeManga meellm/memanga:0.5.0 check --auto --quiet

The time is the time of your machine, because your machine starts the run.

With the Compose file from above, the line is shorter. Replace COMPOSE-DIR with the folder that holds compose.yaml; -T tells Compose that there is no terminal:

sh
0 6 * * * cd "COMPOSE-DIR" && docker compose run --rm -T memanga check --auto --quiet

Image built from source: memanga watch ​

memanga watch stays running, checks once at the start and then again after each interval: every 6 hours unless you say otherwise, and not more often than every 15 minutes. The published image has it too, as the last part of the docker run command.

The ready-made scheduler service is in a second Compose file, compose.dev.yaml, which builds the image from the source code. You need Git and Docker; Python is not needed.

  1. Get a copy of the source code:

    sh
    git clone https://github.com/meellm/MeManga.git
    cd MeManga
  2. Save this file as compose.dev.yaml in that folder, next to Dockerfile. If the folder already has a compose.dev.yaml, use that one instead.

yaml
# Development setup: builds the image from this source checkout and has
# the scheduler service, which runs `memanga watch`.
#
# Use it by naming the file on every command:
#   docker compose -f compose.dev.yaml build
#   docker compose -f compose.dev.yaml run --rm memanga list
#   docker compose -f compose.dev.yaml up -d scheduler
#
# It uses the same volume names as compose.yaml, so it keeps the data of an
# earlier `docker compose` setup made from this directory.

x-memanga: &memanga
  build: .
  image: memanga:cli
  volumes:
    - memanga-config:/home/memanga/.config/memanga
    - memanga-downloads:/home/memanga/Downloads/MeManga

services:
  # One-off commands:
  #   docker compose -f compose.dev.yaml run --rm memanga <command>
  memanga:
    <<: *memanga
    command: ["list"]

  # Scheduled checks:
  #   docker compose -f compose.dev.yaml up -d scheduler
  scheduler:
    <<: *memanga
    command: ["watch", "--every", "6h", "--jitter", "30m"]
    restart: unless-stopped
    # Time for a running check to save its state on docker stop.
    stop_grace_period: 1m

volumes:
  memanga-config:
  memanga-downloads:
  1. Build the image and run commands from that folder. Name the file on every command:

    sh
    docker compose -f compose.dev.yaml build
    docker compose -f compose.dev.yaml run --rm memanga list
    docker compose -f compose.dev.yaml up -d scheduler

What the services do:

  • memanga is the service for single commands.
  • scheduler runs memanga watch every 6 hours with a random delay of up to 30 minutes. Docker starts it again when it ends or the machine restarts, unless you stopped it yourself.
  • docker compose -f compose.dev.yaml logs scheduler shows what it did, and docker compose -f compose.dev.yaml stop scheduler stops it.

To avoid typing the file name, set COMPOSE_FILE=compose.dev.yaml in your shell for that folder.

To use newer source code, run git pull in that folder and then the build command again.

If git pull stops because it would overwrite compose.dev.yaml, the newer source code brings its own copy of that file. Keep yours: rename it to a name that no other file in the folder has, or move it to another folder. Then run git pull again. If you had changed your copy, compare it with the new compose.dev.yaml and make the same changes there before you build.

If you already use Compose in a copy of the source code

Look at compose.yaml in that folder. If it has a build: setting, it builds from the source code and uses the same volumes as compose.dev.yaml. Otherwise it runs the published image.

  • Use -f compose.dev.yaml from now on, as shown above. Your settings, library and downloads stay as they are.
  • A compose.yaml that runs the published image opens the same volumes with that image when you leave out -f compose.dev.yaml. An older image may not be compatible with data a newer version has written. Keep using -f compose.dev.yaml for that data, and do not mix the two on one set of data.
  • If the scheduler is running, it keeps running. Manage it with -f compose.dev.yaml.

Stopping and the init option ​

When a container is stopped, Docker first asks the program to end and ends it by force after a waiting time, 10 seconds unless you set another.

A check that is stopped keeps the chapters it had already finished, and memanga watch lets a running check save its results first. compose.dev.yaml gives it one minute for that. With plain Docker, use docker stop -t 60 CONTAINER.

--init: the browsers start helper processes. Something has to clean up after them when they end. The image has this built in, so --init is not needed and does no harm. The commands on this page keep it because images before 0.5.0 need it.

Update the image ​

Your data is in the volumes or folders, not in the image, so updating is pulling a newer image and using its tag from then on:

sh
docker pull meellm/memanga:NEW-VERSION

Replace NEW-VERSION with the version you want. Read the release notes first. Keep a copy of the config folder before a larger update; memanga export writes your library and the downloaded and read chapters of each series into one file (see Data files and backups).

To remove an old image, use docker image rm with its name and tag. Removing an image does not touch the volumes.

Time zone ​

Without a setting, the clock in the published image shows UTC. MeManga uses the container's local time for the times it prints and saves, so those are in UTC too.

To use another time zone, set the TZ variable to a zone name when you start the container. Replace Europe/Berlin with your zone:

sh
docker run --rm --init -e TZ=Europe/Berlin \
  -v memanga-config:/home/memanga/.config/memanga \
  -v memanga-downloads:/home/memanga/Downloads/MeManga \
  meellm/memanga:0.5.0 status

What this does and does not change:

  • It changes the local time inside the container.
  • It does not change when a run starts. A schedule in your machine's cron follows your machine's clock, whatever TZ says.
  • memanga watch counts intervals and does not depend on the time of day.
  • Pass the same TZ on every run, so that saved times stay comparable.

With Compose, put TZ=Europe/Berlin in the .env file instead: see Use Docker Compose. compose.dev.yaml has no such setting.

When something does not work ​

  • "Permission denied" or MeManga cannot save. A folder from your machine is not writable for user ID 1000. See Folders on your machine, or switch to named volumes.
  • A command stops and says it needs a terminal, or a question never appears. Add -it, or write the command so that it asks nothing. See Run commands.
  • My library is empty after a restart. The run did not use the same volumes or folders as before. Check both -v parts of the command.
  • A command or an option is not recognised. It may be newer than the image you run. memanga --help in the container shows what it has: put --help as the last part of the command.
  • --gui is refused. The image has no desktop app.
  • A source fails only in the container. Sources change and block automated visits from time to time; this is not specific to Docker. Try the same series again later, or on another source.

Planned ​

These are not available yet:

  • A smaller image with fewer browsers: issue 332.
  • A time zone setting in compose.dev.yaml: issue 331.

Released under the MIT License.