Skip to content

Instantly share code, notes, and snippets.

@pwalkr
Created December 9, 2022 02:59
Show Gist options
  • Save pwalkr/de932e29a55556bc879c17ba0c59e052 to your computer and use it in GitHub Desktop.
Save pwalkr/de932e29a55556bc879c17ba0c59e052 to your computer and use it in GitHub Desktop.
Foreground ansible docker_container times out

Error

TASK [backup to backblaze] ********************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: requests.exceptions.ConnectionError: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out.
fatal: [cirrus]: FAILED! => {"changed": false, "msg": "An unexpected requests error occurred when trying to talk to the Docker daemon: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out."}

Source

- name: restic
  hosts: nas
  gather_facts: false
  vars:
    restic_root: '/srv/nfs'
    restic_image: 'restic/restic:0.14.0'
    restic_env:
      B2_ACCOUNT_ID: '{{ vault_backblaze_keyid }}'
      B2_ACCOUNT_KEY: '{{ vault_backblaze_appkey }}'
      RESTIC_PASSWORD: '{{ vault_backblaze_restic_key }}'
      RESTIC_REPOSITORY: '******************'
  vars_files:
    - vars/vault.yml
  tasks:
    - name: backup to backblaze
      community.docker.docker_container:
        name: restic
        image: '{{ restic_image }}'
        env: '{{ restic_env }}'
        entrypoint: ['sh', '-c']
        command: "'restic backup {{ restic_root }} --host=nas --verbose=2 2>&1 | grep -v \"^unchanged \"'"
        volumes:
          - '{{ snapshot_root }}:{{ restic_root }}:ro'
        detach: no
        log_driver: loki
        log_options: '{{ loki_log_opts }}'

Meta

LC_ALL=en_US.UTF-8 ansible --version
ansible [core 2.14.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/strayguin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/strayguin/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment