Ansible Container and time out
during the process of storing large image files

If you have encountered the issue related to time out (during the build process of images while using ansible-container), take a look here:

Reproducing the issue (macOS)

$ python2.7 -m ensurepip --default-pip
$ sudo pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
$ pip install ansible
$ pip install ansible-container[docker]
$ pip install docker==2.7.0

Clone the repo and build image

$ git clone https://github.com/mkowsiak/ansible-with-big-file.git
$ cd ansible-with-big-file
$ ansible-container build --no-cache
    
# at some point, you will get ReadTimeout (timeout=60) - it is coming from conductor
...
...
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 642, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 515, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: UnixHTTPConnectionPool(host='localhost', port=None): 
     Read timed out. (read timeout=60)
Conductor terminated. Cleaning up.
...
...

How to fix the issue?

git clone https://github.com/ansible/ansible-container.git
cd ansible-container
pip install -e .[docker]
    
# Modify file: ansible-container/container/docker/templates/conductor-local-dockerfile.j2
echo "" >> \
  ansible-container/container/docker/templates/conductor-local-dockerfile.j2
echo "ENV DOCKER_CLIENT_TIMEOUT=600" >> \
  ansible-container/container/docker/templates/conductor-local-dockerfile.j2
    
# Create image. This time, using custom conductor
cd ansible-with-big-file
ansible-container build --no-cache

Leave a comment

Your comment