[Unit]
Description=%p container
Requires=service.system.docker.service
After=service.system.docker.service

[Service]
Restart=always
RestartSec=10s
TimeoutStartSec=0
ExecStartPre=-/bin/sh -c "mkdir -p /storage/%p/config /storage/%p/data"
ExecStart=/storage/.kodi/addons/service.system.docker/bin/docker run \
          --rm \
          --name=%p \
          --hostname=libreelec-%p \
          --volume=/storage/%p/config:/config \
          --volume=/storage/%p/data:/data \
          --publish=5050:5050 \
          timhaak/%p
ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker stop %p

[Install]
WantedBy=multi-user.target
