0

I have an application, which I would like to run as systemd user services.

This application can interact with Docker containers, which works when I run the application like /usr/bin/app from User u.

But when I load the application as a user service, systemctl enable --now --user app.service, I get the following error:

 time="2023-06-19T14:43:15+02:00" level=error msg="Cannot get containers: could not get containers from Docker (Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&limit=0\": dial unix /var/run/docker.sock: connect: permission denied)"

The systemd service is defined as

[Unit]
Description=App description
After=network.target

[Service]
ExecStart=/usr/bin/app
Restart=always

[Install]
WantedBy=default.target

Should the service behave like "just" running the application as a binary?

The user is already in the Docker group.

I have looked at:

But neither solves my problem.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Lars Nielsen
  • 2,005
  • 2
  • 25
  • 48

0 Answers0