|
I have a docker container on a Synology NAS that updates some Sonarr config things. However, I need to manually pass a (sudo) command to docker through the CLI when I want to update (sudo docker exec..) What's the best way to have this command run automatically every day at a specific time? e: also because I have to SSH in to run commands and I don't want to leave that open so I have to turn it on and back off each time PRADA SLUT fucked around with this message at 04:22 on Apr 21, 2024 |
# ? Apr 21, 2024 04:16 |
|
|
# ? Apr 24, 2024 12:47 |
|
Can’t you just add your user to the “docker” group to avoid sudo?
|
# ? Apr 21, 2024 04:47 |
|
sudo crontab -e that's it, that's all ya gotta do
|
# ? Apr 21, 2024 05:15 |
|
Tatsuta Age posted:sudo crontab -e Command not found. Is there a way to set up a script or something through the UI, such that I can manage these items without needing to constantly open and close SSH? Like a way to write some commands I want in a .sh file and shove that on a drive somewhere to have the NAS run at some interval? IUG posted:Can’t you just add your user to the “docker” group to avoid sudo? How do I know what user docker execs as? I have some containers I pass PUID and PGID but I don't know how those relate to a specific user and how to find/set them otherwise This is what I get now when I run as non-sudo but I don't know how to tell the perms I need: 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/recyclarr/json": dial unix /var/run/docker.sock: connect: permission denied PRADA SLUT fucked around with this message at 06:34 on Apr 21, 2024 |
# ? Apr 21, 2024 06:31 |
|
If you add your user to the docker group it doesn't affect your UID/GID. It will let you run docker without the need for sudo. That's it. Then you can crontab -e as your login user and add your docker commend or wrap it in a script (remember that crontab runs as /bin/sh and doesn't have your regular bash profile available in it, so a wrapper script with it sourced is your best bet).
|
# ? Apr 21, 2024 11:41 |
|
Yeah your error isn’t in Docker, it’s permission denied trying to run Docker commands. The container isn’t having the issue.
|
# ? Apr 21, 2024 13:03 |
|
I guess what I’m asking is that I don’t know which user docker executes as, since there’s no user groups I see impacting docker in my Synology user/group settings.
|
# ? Apr 21, 2024 17:54 |
|
Why the hell are you dicking around in CLI on a Synology anyway?
|
# ? Apr 21, 2024 19:10 |
|
Matt Zerella posted:Why the hell are you dicking around in CLI on a Synology anyway? Something that needs done. PRADA SLUT posted:I have a docker container on a Synology NAS that updates some Sonarr config things. However, I need to manually pass a (sudo) command to docker through the CLI when I want to update (sudo docker exec..)
|
# ? Apr 21, 2024 20:16 |
|
That should be done inside of the docker container, not from the host CLI, wtf.
|
# ? Apr 21, 2024 20:18 |
|
Matt Zerella posted:That should be done inside of the docker container, not from the host CLI, wtf. Wtf, the dude wanted automatic updates which it seems is not possible in the OPs current situation, wtf? Maybe help out with an answer? Edit: reminder. The guy could not access crontab -e. EVIL Gibson fucked around with this message at 20:36 on Apr 21, 2024 |
# ? Apr 21, 2024 20:34 |
|
EVIL Gibson posted:Wtf, the dude wanted automatic updates which it seems is not possible in the OPs current situation, wtf? If this is recyclarr it's got built in cron inside of the container. Trying to automate this by firing a command into the docker and potentially breaking the implementation on a device meant to be used with a GUI is an exercise in futility. I'm trying to help here by saying this is not the right way to go about this!
|
# ? Apr 21, 2024 20:37 |
|
Pull the latest image and recreate the container. Not having to janitor the packages inside the container is kinda what makes containers so useful and easy.
|
# ? Apr 21, 2024 23:15 |
|
PRADA SLUT posted:I guess what I’m asking is that I don’t know which user docker executes as, since there’s no user groups I see impacting docker in my Synology user/group settings. You don't need to know because your ability to run a docker command without sudo in front of it is not determined by what user owns the docker process. It is determined by whether the user you are logged in as, has permission to run docker commands without sudo. IUG already gave you the answer here. On most distros this would be a usermod command, but Synology is special according to this post I found. While I'm a big proponent of docker without sudo, I do agree that this probably isn't the best way to handle whatever specific task you're actually trying to do.
|
# ? Apr 21, 2024 23:57 |
|
Matt Zerella posted:If this is recyclarr it's got built in cron inside of the container. Trying to automate this by firing a command into the docker and potentially breaking the implementation on a device meant to be used with a GUI is an exercise in futility. I'm trying to help here by saying this is not the right way to go about this! I see the docs how it asks for docker compose up -d to start in cron mode, but how do I implement this? Docker compose isn't a command the CLI recognizes. I just want this to update daily without any intervention. Is this a variable I call out in my compose yml? I can't pass up -d through an exec either. When I view the environment vars in DSM it lists CRON_SCHEDULE @daily but I don't know if that means it's running daily or if its just holding that timeframe waiting for some type of launch parameter. other people posted:Pull the latest image and recreate the container. Not having to janitor the packages inside the container is kinda what makes containers so useful and easy. I already have Watchtower to update containers but it only runs when there's a new release of something. PRADA SLUT fucked around with this message at 06:18 on Apr 22, 2024 |
# ? Apr 22, 2024 06:05 |
|
PRADA SLUT posted:I already have Watchtower to update containers but it only runs when there's a new release of something. If the contents of the image need updating then there should be a new release of the container image. Though you originally say you are trying to update "some Sonarr config things" which almost sounds like the container isn't an app or has some baked in configs that you need to modify??? Anyway, I know you are likely not the image author so you may not be able to control this stuff directly but in general if one is needing to modify/update bits of the shipped image then you are doing it wrong. Maybe the bits you need to update can instead be on a volume mounted in the container so a host process can easily modify them without touching the container? Or if they have to be part of the baked image then it isn't too difficult to have your own Dockerfile that extends the image you are using. sorry to keep harping on this but whatever solution you find for your current task is going to be clunky because it goes against what the tools are designed to help do.
|
# ? Apr 22, 2024 07:44 |
|
PRADA SLUT posted:I see the docs how it asks for docker compose up -d to start in cron mode, but how do I implement this? Docker compose isn't a command the CLI recognizes. I just want this to update daily without any intervention. Is this a variable I call out in my compose yml? I can't pass up -d through an exec either. https://recyclarr.dev/wiki/installation/docker/#cron-mode Checking the documentation, by default the cron mode is set to daily. You only need to set that variable if you want to modify that schedule (you don't, mine runs default). So basically you don't need to do anything lol. You can check your logs for the docker container and you should see it running once a day.
|
# ? Apr 22, 2024 15:15 |
|
|
# ? Apr 24, 2024 12:47 |
|
hey PS, did recyclarr update today?
|
# ? Apr 23, 2024 15:17 |