Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

user for docker container restarts

Featured Replies

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

Solved by t0mi

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.

  • Author

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

  • 5 months later...
  • Solution

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 by t0mi

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.

oh you are completly right

  • Author

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?

  • Author

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

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.

  • Author

ok will try this to implement into cron container, thanks

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.