sugarle666 Posted April 3 Share Posted April 3 Hi, im looking for a solution to let a user restart / update a docker container hosted in unraid. I wont give a full access to unraid gui. Is there a possible way to add a user where can just restart / start / stop and update a running container? It would also fine with a second gui in a container or so that can do this stuff Quote Link to comment
JonathanM Posted April 3 Share Posted April 3 Short answer, no, there is currently no way to add limited access GUI users. Since docker start stop and restarts are easy on the command line, you can do scripting that looks at a user accessible share location for input. Updates are probably possible, but I have no experience doing updates from the CLI. The script would watch for and act on the existence of a specifically formatted file to show up or change in a user share location. The user would connect to the SMB share that has permissions for that user to create or modify files, and manipulate the file(s) the script is watching for. As a quick example, you could look for the existence of a file named restart.txt, when found the script would restart the container and delete the restart.txt file. Quote Link to comment
sugarle666 Posted April 4 Author Share Posted April 4 hi JonathanM, hmm okay, sounds not very userfriendly... i will look into it a bit deeper... maybe i find a solution that is a bit easier without a smb user or wild scripting, where im not a expert in Quote Link to comment
t0mi Posted September 7 Share Posted September 7 (edited) Hello, i searched for the exact same (im running a gameserver docker for my friends and sometimes the server have to be restarted) Im also hosting nextcloud so i created a user for them where if they need to restart they just create the file restart.txt the script: #!/bin/bash # Name of the Docker container CONTAINER_NAME="CoreKeeper" # Path to the watch file RESTART_FILE="/mnt/nvmepool/appdata/nextcloud/data/corekeeper/files/restart.txt" # Infinite loop to check for the file while true; do if [ -f "$RESTART_FILE" ]; then echo "File $RESTART_FILE found. Restarting the Docker container..." # Restart the Docker container docker restart $CONTAINER_NAME # Delete the file to reset the process rm -f "$RESTART_FILE" echo "Docker container has been restarted and the file has been deleted." fi # Wait for 60 seconds before checking again sleep 60 done UPDATE: do it as userscript in settings and forget that below In Unraid you open the console and create the restartdockercontainer.sh Create new file and paste the code inside nano restartdockercontainer.sh CTRL+X and save it with Y use following command so the script can be executed chmod +x restartdockercontainer.sh you then can run it with nohup ./restartdockercontainer.sh & if you restart your unraid maschine u would need to start it again, you can check if it is running with command ps and kill it with kill <id> Edited September 9 by t0mi Quote Link to comment
JonathanM Posted September 7 Share Posted September 7 7 hours ago, t0mi said: In Unraid you open the console and create the restartdockercontainer.sh it would be easier to use the userscripts plugin so you don't have to redo everything at each reboot. Quote Link to comment
sugarle666 Posted September 9 Author Share Posted September 9 That sounds like a good workaround for it and you need for every Container Name a own Userscript where you define CONTAINER_NAME again right? Quote Link to comment
sugarle666 Posted September 13 Author Share Posted September 13 i tried this workaround and it worked fine via nextcloud... how do you fixed the nextcloud issues? if the file is removed via script it is shown in nextcloud as well and not removed there after a few minutes so in worstcase i can't create a new one because for nextcloud it still exist Quote Link to comment
JonathanM Posted September 13 Share Posted September 13 Nextcloud is a poor choice, the files are not synchronized between disk and display automatically, you must force a refresh to update the nextcloud database with the new content of the disk. 1 Quote Link to comment
sugarle666 Posted September 13 Author Share Posted September 13 ok will try this to implement into cron container, thanks Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.