Reputation: 2600
I'm trying to configure docker exec
with systemd service, but it always fail.
Q: Is that possible to run that way or I need to use inside a bash script (.sh)?
/etc/systemd/system/laravel.service
[Unit]
Description=Laravel Queue
After=docker.service
Requires=docker.service
[Service]
Type=simple
ExecStart="/usr/bin/docker exec -it my_docker /usr/bin/php artisan queue:work --env=production --tries 2 --timeout 60"
User=ubuntu
Group=ubuntu
KillMode=process
Restart=always
[Install]
WantedBy=multi-user.target
sudo service vetspay status
jan 05 03:04:39 legolas systemd[1]: Started Laravel Queue.
jan 05 03:04:39 legolas systemd[1]: laravel.service: Main process exited, code=exited, status=216/GROUP
jan 05 03:04:39 legolas systemd[1]: laravel.service: Unit entered failed state.
jan 05 03:04:39 legolas systemd[1]: laravel.service: Failed with result 'exit-code'.
Upvotes: 1
Views: 3669
Reputation: 166
The error (the input device is not...) is caused by : -it in this line ExecStart="/usr/bin/docker exec -it my_docker /usr/bin/php artisan queue:work --env=production --tries 2 --timeout 60"
User=ubuntu
, remove it, it is not necessary when docker exec is in bash file
Upvotes: 1
Reputation: 2600
I tested the command inside a script and got the error: the input device is not a TTY
Basically I cannot use the command with -t
because those are non interactive. Removing it now it's working properly!
Where I found the answer:
Upvotes: 0