Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete content of config.json upon every restart #1904

Open
lukjod opened this issue Jan 19, 2024 · 1 comment
Open

Delete content of config.json upon every restart #1904

lukjod opened this issue Jan 19, 2024 · 1 comment

Comments

@lukjod
Copy link

lukjod commented Jan 19, 2024

Describe the bug

I have strange problem, that after every restart of my qnap config file with login and passwords inside for watchtower is changing from file into open folder. So after every restart i must delete that folder and create new file from ssh. When using script which after every restart tries to do it automatically it doesn't see that directory in my case /root/.docker/config.json.
My script is called by RunLast mathod which calls scripts after complete qnap restart with fully started enviroment.
script:

#!/bin/bash
PATH=/opt/bin:/opt/sbin:/share/CACHEDEV1_DATA/.qpkg/container-station/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin:/root/.docker:$PATH
sleep 300s
docker stop gotify
sleep 3s
rm -r /root/.docker/config.json
rmdir --ignore-fail-on-non-empty /root/.docker/config.json
docker stop watchtower
sleep 3s
docker login -u lukjod -p *************
sleep 3s
docker login ghcr.io/haveagitgat/tdarr -u lukjod -p ghp_C3Zu6lnz1111111111111111
sleep 3s
docker start gotify
sleep 3s
docker start watchtower

log

`RunLast (20230112)
[Wed Jan 10 18:36:06 CET 2024] begin "start" scripts ...
[Wed Jan 10 18:36:06 CET 2024] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/10-crontab_restart.sh'" ...
[Wed Jan 10 18:36:12 CET 2024] => exitcode: (0)
[Wed Jan 10 18:36:12 CET 2024] => stdout: "Stopping periodic command scheduler: crond.
Starting periodic command scheduler: crond."
[Wed Jan 10 18:36:12 CET 2024] => stderr: ""
[Wed Jan 10 18:36:12 CET 2024] -> execute: "'/share/CACHEDEV1_DATA/.qpkg/RunLast/scripts/20-docker_restart.sh'" ...
[Wed Jan 10 18:41:27 CET 2024] => exitcode: (1)
[Wed Jan 10 18:41:27 CET 2024] => stdout: "watchtower
Login Succeeded
Login Succeeded
gotify"
[Wed Jan 10 18:41:27 CET 2024] => stderr: "rmdir: '/root/.docker/config.json': No such file or directory
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /share/homes/admin/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /share/homes/admin/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/root/.docker/config.json" to rootfs at "/config.json": mount /root/.docker/config.json:/config.json (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Error: failed to start containers: watchtower"
[Wed Jan 10 18:41:27 CET 2024] end "start" scripts`

Steps to reproduce

my docker config

docker create
--name watchtower
-e PUID=1000
-e PGID=100
-e TZ=Europe/Warsaw
-e WATCHTOWER_POLL_INTERVAL=900
-v /var/run/docker.sock:/var/run/docker.sock
-v $HOME/.docker/config.json:/config.json
-e WATCHTOWER_NOTIFICATIONS=gotify
-e WATCHTOWER_NOTIFICATION_GOTIFY_URL="http://192.168.1.197:12680"
-e WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN="Ab111111111"
-e WATCHTOWER_DEBUG=true
-e WATCHTOWER_CLEANUP=true
--restart always
containrrr/watchtower

Expected behavior

Do not delete previous created config.json file and replace it with empty config.json directory on every qnap restart

Screenshots

No response

Environment

Qnap 264 x64 linux

Your logs

no logs

Additional context

No response

Copy link

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant