Autostart bitwarden docker container on bootup Ubuntu Server

Hi,
I’m working to get bitwarden to auto-start properly on bootup of my Ubuntu 20.04 LTS server. I’ve used the following /etc/systemd/system/bitwarden.server file, but on bootup it fails and bombs out. I think it’s because it runs the script twice so it creates too many docker network ‘docker_public’ entries. And I think this is because it doesn’t wait on reboot to shut it down cleanly, but just fires off the ExecStop script without waiting properly.

Blockquote

cat /etc/systemd/system/bitwarden.service

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

[Service]
#Restart=always
ExecStart=/opt/bitwarden/bitwarden.sh start
ExecStop=/opt/bitwarden/bitwarden.sh stop
Type=oneshot
RemainAfterExit=true

[Install]
WantedBy=default.target

But some simple testing with “systemctl stop bitwarden” and “systemctl start bitwarden” shows that it works properly. Hmm… maybe I need to let it wait a minute or two after startup? Has anyone got a good solution here?

Thanks,
J