Opsi Backup in Docker Container

Antworten
rene_z
Beiträge: 2
Registriert: 19 Mär 2025, 11:11

Opsi Backup in Docker Container

Beitrag von rene_z »

Hallo,
ich habe einen opsi über Docker eingerichet.
Ich wollte jetzt über einen Cronjob vom Host mit

Code: Alles auswählen

'docker exec opsi-server opsiconfd backup
' regelmäßige Updates erstellen, bekomme aber immer die gleichen Fehler. Wenn ich mit '

Code: Alles auswählen

docker exec -it opsi-server /bin/bash
' in den container gehe und dann 'opsiconfd backup' ausführe, funktioniert das problemlos.
Ich werde aus der Fehlermeldung leider nicht schlau. Kann mir da vielleicht einer Helfen?

Hier der Fehler:

Code: Alles auswählen

> docker exec -t opsi-server opsiconfd backup
Creating backup opsiconfd-backup-20250319-113813.msgpack.lz4
Using arguments: config_files=True, redis_data=True, maintenance=True, encoding=msgpack, compression=lz4, encrypt=False
Exception in thread Thread-2 (run):
Traceback (most recent call last):
  File "redis/asyncio/connection.py", line 281, in connect
  File "redis/asyncio/retry.py", line 59, in call_with_retry
  File "redis/asyncio/connection.py", line 697, in _connect
  File "asyncio/streams.py", line 48, in open_connection
  File "asyncio/base_events.py", line 1169, in create_connection
OSError: Multiple exceptions: [Errno 111] Connect call failed ('::1', 6379, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 6379)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "threading.py", line 1041, in _bootstrap_inner
  File "threading.py", line 992, in run
  File "asyncio/runners.py", line 194, in run
  File "asyncio/runners.py", line 118, in run
  File "asyncio/base_events.py", line 720, in run_until_complete
  File "opsiconfd/application/__init__.py", line 268, in app_state_manager_task
  File "contextlib.py", line 214, in __aenter__
  File "opsiconfd/redis.py", line 347, in async_redis_lock
  File "redis/asyncio/client.py", line 611, in execute_command
  File "redis/asyncio/connection.py", line 1064, in get_connection
  File "redis/asyncio/connection.py", line 1097, in ensure_connection
  File "redis/asyncio/connection.py", line 289, in connect
redis.exceptions.ConnectionError: Error Multiple exceptions: [Errno 111] Connect call failed ('::1', 6379, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 6379) connecting to localhost:6379.
[4] [2025-03-19 11:38:20.152] [               ] Could not clear check cache. No Connection to Redis.   (cache.py:29)

[3] [2025-03-19 11:38:25.154] [               ] Error 111 connecting to localhost:6379. Connection refused.   (backup.py:122)
Traceback (most recent call last):
  File "redis/connection.py", line 357, in connect
  File "redis/retry.py", line 62, in call_with_retry
  File "redis/connection.py", line 358, in <lambda>
  File "redis/connection.py", line 730, in _connect
  File "redis/connection.py", line 718, in _connect
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "opsiconfd/main/backup.py", line 102, in backup_main
  File "opsiconfd/check/cache.py", line 43, in wrapper
  File "opsiconfd/backup.py", line 147, in create_backup
  File "contextlib.py", line 141, in __enter__
  File "opsiconfd/redis.py", line 309, in redis_lock
  File "redis/commands/core.py", line 2335, in set
  File "redis/client.py", line 559, in execute_command
  File "redis/client.py", line 565, in _execute_command
  File "redis/connection.py", line 1422, in get_connection
  File "redis/connection.py", line 363, in connect
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
Failed to create backup file '/opsiconfd-backup-20250319-113813.msgpack.lz4': Error 111 connecting to localhost:6379. Connection refused.
Benutzeravatar
j.schneider
uib-Team
Beiträge: 2044
Registriert: 29 Mai 2008, 15:14

Re: Opsi Backup in Docker Container

Beitrag von j.schneider »

Hallo,

beim Ausführen der bash im Container werden noch ein paar Umgebungsvariablen gesetzt.
So sollte es funktionieren:

Code: Alles auswählen

docker exec opsi-server bash -l -c "opsiconfd backup"
Grüße
Jan Schneider


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


rene_z
Beiträge: 2
Registriert: 19 Mär 2025, 11:11

Re: Opsi Backup in Docker Container

Beitrag von rene_z »

Hallo,

vielen Dank für die schnelle Hilfe. Jetzt funktioniert es bei mir! :D

Viele Grüße
Rene
Antworten