[GH-ISSUE #2025] "Running with systemd (docker)" don't launch in the background and don't restart #1129

Closed
opened 2026-03-03 02:06:30 +03:00 by kerem · 0 comments
Owner

Originally created by @ctschach on GitHub (Oct 7, 2021).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/2025

Subject of the issue

"Running with systemd (docker)" don't launch in the background and don't restart

I'm starting the docker instance of Vaultwarden via systemd as described in this Wiki:

https://github.com/dani-garcia/vaultwarden/wiki/Running-with-systemd-docker

However, I noticed two problem:

  • "systemctl start vaultwarden.service" does not run in the background. It launches the docker instance, but never come back to the shell. So I had to use Ctrl-Z and "bg" to let it run in the background.
  • At some point the docker process was not running anymore. Not sure what the problem was, but it did not automatically restart - which should happen when you use systemd.

Deployment environment

  • OS:
    Ubuntu 18.04LTS on x86

  • vaultwarden version:
    vaultwarden/server:latest

  • Install method:
    docker.

Configuration

Here is the content of my service-file:
/etc/systemd/system/vaultwarden.service

[Unit]
Description=Vaultwarden
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker pull vaultwarden/server:latest
ExecStartPre=-/usr/bin/docker stop vaultwarden
ExecStartPre=-/usr/bin/docker rm vaultwarden
ExecStart=/usr/bin/docker run \
  -p 8888:80 \
  -p 3012:3012 \
  --env-file /home/vaultwarden/etc/vaultwarden.conf \
  -v /home/vaultwarden/data/:/data/ \
  --rm --name vaultwarden vaultwarden/server:latest
ExecStopPost=-/usr/bin/docker rm vaultwarden
Restart=Always
RestartSec=30s
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target
Originally created by @ctschach on GitHub (Oct 7, 2021). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/2025 ### Subject of the issue "Running with systemd (docker)" don't launch in the background and don't restart <!-- Describe your issue here. --> I'm starting the docker instance of Vaultwarden via systemd as described in this Wiki: https://github.com/dani-garcia/vaultwarden/wiki/Running-with-systemd-docker However, I noticed two problem: * "systemctl start vaultwarden.service" does not run in the background. It launches the docker instance, but never come back to the shell. So I had to use Ctrl-Z and "bg" to let it run in the background. * At some point the docker process was not running anymore. Not sure what the problem was, but it did not automatically restart - which should happen when you use systemd. ### Deployment environment * OS: Ubuntu 18.04LTS on x86 * vaultwarden version: vaultwarden/server:latest <!-- How the server was installed: Docker image, OS package, built from source, etc. --> * Install method: docker. ### Configuration Here is the content of my service-file: /etc/systemd/system/vaultwarden.service ``` [Unit] Description=Vaultwarden After=docker.service Requires=docker.service [Service] TimeoutStartSec=0 ExecStartPre=-/usr/bin/docker pull vaultwarden/server:latest ExecStartPre=-/usr/bin/docker stop vaultwarden ExecStartPre=-/usr/bin/docker rm vaultwarden ExecStart=/usr/bin/docker run \ -p 8888:80 \ -p 3012:3012 \ --env-file /home/vaultwarden/etc/vaultwarden.conf \ -v /home/vaultwarden/data/:/data/ \ --rm --name vaultwarden vaultwarden/server:latest ExecStopPost=-/usr/bin/docker rm vaultwarden Restart=Always RestartSec=30s Type=notify NotifyAccess=all [Install] WantedBy=multi-user.target ```
kerem closed this issue 2026-03-03 02:06:30 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#1129
No description provided.