Configure systemd service as regular user.

Create systemd configuration directory.

$ mkdir -p ~/.config/systemd/user/

Create user service.

$ tee ~/.config/systemd/user/archivebox.service <<EOF
[Unit]
Description=archivebox service

[Service]
Restart=always

WorkingDirectory=/home/archivebox/archivebox

ExecStartPre=/usr/bin/docker-compose -f docker-compose.yml down
ExecStart=/usr/bin/docker-compose -f docker-compose.yml up
ExecStop=/usr/bin/docker-compose -f docker-compose.yml down

[Install]
WantedBy=default.target
EOF

Reload user related systemd configuration.

$ systemctl --user daemon-reload

Inspect service status.

$ systemctl --user status archivebox
● archivebox.service - archivebox service
     Loaded: loaded (/home/archivebox/.config/systemd/user/archivebox.service; disabled; vendor preset: enabled)
     Active: inactive (dead)

Enable and start service.

$ systemctl --user enable --now  archivebox
Created symlink /home/archivebox/.config/systemd/user/default.target.wants/archivebox.service → /home/archivebox/.config/systemd/user/archivebox.service.

Inspect service status.

$ systemctl --user status archivebox
● archivebox.service - archivebox service
     Loaded: loaded (/home/archivebox/.config/systemd/user/archivebox.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-12-23 00:26:32 CET; 45s ago
    Process: 179448 ExecStartPre=/usr/bin/docker-compose -f docker-compose.yml down (code=exited, status=0/SUCCESS)
   Main PID: 179449 (docker-compose)
      Tasks: 3 (limit: 779)
        CPU: 5.312s
     CGroup: /user.slice/user-1001.slice/user@1001.service/app.slice/archivebox.service
             └─179449 /usr/bin/python3 /usr/bin/docker-compose -f docker-compose.yml up

Dec 23 00:26:30 raspberrypi systemd[179363]: Starting archivebox service...
Dec 23 00:26:32 raspberrypi docker-compose[179448]: Removing network archivebox_default
Dec 23 00:26:32 raspberrypi docker-compose[179448]: Network archivebox_default not found.
Dec 23 00:26:32 raspberrypi systemd[179363]: Started archivebox service.
Dec 23 00:26:36 raspberrypi docker-compose[179449]: Creating network "archivebox_default" with the default driver
Dec 23 00:26:38 raspberrypi docker-compose[179449]: Creating archivebox_archivebox_1 ...

Enable user lingering, so the user related systemd configuration will be read at boot.

$ loginctl enable-linger archivebox

Verify altered parameter.

$ loginctl show-user -p Linger $USER
Linger=yes

That is all.