auanasgheps / snapraid-aio-script

The definitive all-in-one SnapRAID script on Linux. Diff, sync, scrub are things of the past. Manage SnapRAID and much, much more!
GNU General Public License v3.0
231 stars 37 forks source link

Remote Docker host error pausing containers. #13

Closed tehniemer closed 3 years ago

tehniemer commented 3 years ago

I gave the most recent script a try last night and came across some new errors in the container control section. It looks like they are pausing, but it's trying a second time without an argument. These are different than the errors I was previously experiencing.

Pausing Containers [Wed 21 Apr 2021 12:00:04 AM CDT]
Pausing Container - Amtd
"docker pause" requires at least 1 argument.
See 'docker pause --help'.
Usage: docker pause CONTAINER [CONTAINER...]
Pause all processes within one or more containers
Pausing Container - Bazarr
"docker pause" requires at least 1 argument.
See 'docker pause --help'.
Usage: docker pause CONTAINER [CONTAINER...]
Pause all processes within one or more containers
Pausing Container - Filebot
"docker pause" requires at least 1 argument.
See 'docker pause --help'.
Usage: docker pause CONTAINER [CONTAINER...]
Pause all processes within one or more containers
Pausing Container - Filerun
"docker pause" requires at least 1 argument.
See 'docker pause --help'.
Usage: docker pause CONTAINER [CONTAINER...]
Pause all processes within one or more containers

...

Resuming Containers [Wed 21 Apr 2021 01:20:17 AM CDT]
Resuming Container - Amtd
"docker unpause" requires at least 1 argument.
See 'docker unpause --help'.
Usage: docker unpause CONTAINER [CONTAINER...]
Unpause all processes within one or more containers
Resuming Container - Bazarr
"docker unpause" requires at least 1 argument.
See 'docker unpause --help'.
Usage: docker unpause CONTAINER [CONTAINER...]
Unpause all processes within one or more containers
Resuming Container - Filebot
"docker unpause" requires at least 1 argument.
See 'docker unpause --help'.
Usage: docker unpause CONTAINER [CONTAINER...]
Unpause all processes within one or more containers
Resuming Container - Filerun
"docker unpause" requires at least 1 argument.
See 'docker unpause --help'.
Usage: docker unpause CONTAINER [CONTAINER...]
Unpause all processes within one or more containers
auanasgheps commented 3 years ago

I made a change recommended by shellcheck, so maybe that's the cause.

Please remove the slash in the pause_services and resume_services functions and let me know if this helps.

pause_services, ssh "$DOCKER_USER"@"$DOCKER_IP" docker "$DOCKER_CMD1" "\$i"

new ssh "$DOCKER_USER"@"$DOCKER_IP" docker "$DOCKER_CMD1" "$i"

resume_services, ssh "$DOCKER_USER"@"$DOCKER_IP" docker "$DOCKER_CMD2" "\$i" new ssh "$DOCKER_USER"@"$DOCKER_IP" docker "$DOCKER_CMD2" "$i"

tehniemer commented 3 years ago

OK, that fixed the first issue, but brought back the issue I had originally with pausing containers on a remote machine.

Pausing Containers [Thu 22 Apr 2021 12:00:03 AM CDT]
Pausing Container - Amtd
amtd
Pausing Container - Bazarr
Error response from daemon: Cannot pause container 266c43695c30f7192e20bd48fa5691f14fc1ff0e328fcb7c3038ade8c0be6f74: OCI runtime pause failed: unable to freeze: unknown
Pausing Container - Filebot
Error response from daemon: Cannot pause container fd41d0d7ab0799eaf41c2e7ce7ad32178f0b1d88e3f279be135abdc2af5e0e62: OCI runtime pause failed: unable to freeze: unknown
Pausing Container - Filerun
filerun

It seems to pause about half of the list and fail on the other half with no perceivable pattern.

auanasgheps commented 3 years ago

In the meantime you can switch to stop, I implemented this feature thinking about you (lol).

Let me know how it goes with and without the slash.

I need to setup another host with docker and play with this.

This is the recommendation from Shellcheck, which needs the right implementation.

Try with the following, I added ' to wrap the command ssh "$DOCKER_USER"@"$DOCKER_IP" 'docker "$DOCKER_CMD1" "$i"' and ssh "$DOCKER_USER"@"$DOCKER_IP" 'docker "$DOCKER_CMD2" "$i"'

EDIT Probably this does not solve the issue. As far as I understood, by sending the wrapped command, the destination server will evaluate the variable, which should not happen because the information is on the client who is running the script.

So yes, you can try the change but probably the result will be the same to the one in the first post.

auanasgheps commented 3 years ago

I've cloned my VM and tested this scenario: the right command is without the slash. I will make the fix now.

The error you're seeing is specific to your host: the script works fine. So you can use the stop command option or troubleshoot what's wrong on your docker server, because I can't reproduce the issue and I can pause containers over SSH just fine.

tehniemer commented 3 years ago

So odd, it was working well for a long time with pause, wonder what's going on with my instance...

auanasgheps commented 3 years ago

You could to ask for help in Docker forums, but also try to manually run the same, at least to validate the case:

I've found a similar issue here