From e83b6f735ea96e58a799e615291f8c87b516ff90 Mon Sep 17 00:00:00 2001 From: elmotec <1107551+elmotec@users.noreply.github.com> Date: Tue, 2 Dec 2025 21:46:58 -0500 Subject: [PATCH] Bind /tmp/docker.sock in backup spawned container Override volumes for the backup runner so the backup process container gets a direct mount of the socket. Otherwise the verb `status` works but `backup` generates the following error: ``` Traceback (most recent call last): File "/restic-compose-backup/.venv/lib/python3.14/site-packages/urllib3/connectionpool.py", line 787, in urlopen response = self._make_request( conn, ...<10 lines>... **response_kw, ) File "/restic-compose-backup/.venv/lib/python3.14/site-packages/urllib3/connectionpool.py", line 493, in _make_request conn.request( ~~~~~~~~~~~~^ method, ^^^^^^^ ...<6 lines>... enforce_content_length=enforce_content_length, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/restic-compose-backup/.venv/lib/python3.14/site-packages/urllib3/connection.py", line 445, in request self.endheaders() ~~~~~~~~~~~~~~~^^ File "/root/.local/share/uv/python/cpython-3.14.0-linux-x86_64-musl/lib/python3.14/http/client.py", line 1333, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.local/share/uv/python/cpython-3.14.0-linux-x86_64-musl/lib/python3.14/http/client.py", line 1093, in _send_output self.send(msg) ~~~~~~~~~^^^^^ File "/root/.local/share/uv/python/cpython-3.14.0-linux-x86_64-musl/lib/python3.14/http/client.py", line 1037, in send self.connect() ~~~~~~~~~~~~^^ File "/restic-compose-backup/.venv/lib/python3.14/site-packages/docker/transport/unixconn.py", line 26, in connect sock.connect(self.unix_socket) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory ``` where self.unix_socket is `/tmp/docker.sock`. --- src/restic_compose_backup/backup_runner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/restic_compose_backup/backup_runner.py b/src/restic_compose_backup/backup_runner.py index f80d64b..9dfe94e 100644 --- a/src/restic_compose_backup/backup_runner.py +++ b/src/restic_compose_backup/backup_runner.py @@ -17,6 +17,7 @@ def run( logger.info("Starting backup container") client = utils.docker_client() + volumes["/var/run/docker.sock"] = {"bind": "/tmp/docker.sock", "mode": "ro"}; container = client.containers.run( image, command,