Skip to content

Problem: Docker build fails, perhaps caused by ip6 issue #1487

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

Closed
5 tasks
ajs6f opened this issue Aug 5, 2021 · 5 comments
Closed
5 tasks

Problem: Docker build fails, perhaps caused by ip6 issue #1487

ajs6f opened this issue Aug 5, 2021 · 5 comments

Comments

@ajs6f
Copy link

ajs6f commented Aug 5, 2021

Expected behaviour
Docker build should succeed. :)

Current behaviour
Docker build fails while trying to run pip commands, e.g.

#14 18.77 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)",)': /simple/agentarchives/

which I am diagnosing (possibly wrongly) as this issue compounded with Docker networking.

Steps to reproduce

$ make create-volumes
$ make build

Your environment (version of Archivematica, operating system, other relevant details)

➜  tmp uname -a   
Linux sporkito 5.11.0-25-generic #27-Ubuntu SMP Fri Jul 9 23:06:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
➜  tmp docker --version
Docker version 20.10.2, build 2291f61
➜  tmp docker-compose --version 
docker-compose version 1.28.5, build c4eb3a1f

I'm sorry if any relevant info is missing-- I'm not a Python programmer and I may be missing something obvious!


For Artefactual use:

Before you close this issue, you must check off the following:

  • All pull requests related to this issue are properly linked
  • All pull requests related to this issue have been merged
  • A testing plan for this issue has been implemented and passed (testing plan information should be included in the issue body or comments)
  • Documentation regarding this issue has been written and merged (if applicable)
  • Details about this issue have been added to the release notes (if applicable)
@ajs6f ajs6f changed the title Problem: Docker build fails, seemingly with ip6 issue Problem: Docker build fails, perhaps caused by ip6 issue Aug 5, 2021
@ajs6f
Copy link
Author

ajs6f commented Aug 6, 2021

Just a further note that adding

  archivematica-storage-service:
    extra_hosts:
      - "pypi.org:151.101.128.223"
    sysctls:
      net.ipv6.conf.all.disable_ipv6: 1

to docker-compose.yml for those containers that could not build does not seem to fix the problem, which militates against my diagnosis.

@ajs6f
Copy link
Author

ajs6f commented Aug 12, 2021

For reasons I cannot guess at, after many tries and without changing anything of which I was aware, this build step succeeded. I suppose there was network oddity of some kind, but it would have been nice to have a definite reason or explanation.

@ajs6f ajs6f closed this as completed Aug 12, 2021
@haiderkn
Copy link

haiderkn commented Jan 6, 2024

For 5 days I have been trying to solve the same issue. In my case docker build installs pip and upgrade pip. Then when installing django from the requirements.txt docker build ends with this ReadTimedOut error. please help. I can install django from terminal, able to ping pypi.org using 443. but cant build the image !! help!

OS: Ubuntu
Dockerrfile:
FROM python:3.9-alpine3.13
LABEL maintainer="haider57"

ENV PYTHONUNBUFFERED 1

COPY ./requirements.txt /tmp/requirements.txt
COPY ./app /app
WORKDIR /app
EXPOSE 8000

RUN python -m venv /py &&
/py/bin/pip install --upgrade pip &&
/py/bin/pip install -r /tmp/requirements.txt &&
rm -rf /tmp &&
adduser
--disabled-password
--no-create-home
django-user

ENV PATH="/py/bin:$PATH"

USER django-user

Error:::::::::::::

docker build .
[+] Building 215.0s (9/9) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 487B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 185B 0.0s
=> [internal] load metadata for docker.io/library/python:3.9-alpine3.13 2.4s
=> [1/5] FROM docker.io/library/python:3.9-alpine3.13@sha256:a7cbd1e7784a35a098cedbc8681b790d35ff6030a5e13f043185e2 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 60B 0.0s
=> CACHED [2/5] COPY ./requirements.txt /tmp/requirements.txt 0.0s
=> CACHED [3/5] COPY ./app /app 0.0s
=> CACHED [4/5] WORKDIR /app 0.0s
=> ERROR [5/5] RUN python -m venv /py && /py/bin/pip install --upgrade pip && /py/bin/pip install -r /tmp 212.3s

[5/5] RUN python -m venv /py && /py/bin/pip install --upgrade pip && /py/bin/pip install -r /tmp/requirements.txt && rm -rf /tmp && adduser --disabled-password --no-create-home django-user:
5.257 Requirement already satisfied: pip in /py/lib/python3.9/site-packages (21.2.4)
20.34 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
35.93 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
52.03 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
69.12 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
88.23 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/
124.0 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/django/
139.6 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/django/
155.7 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/django/
172.8 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/django/
191.9 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/django/
207.1 ERROR: Could not find a version that satisfies the requirement Django<3.3,>=3.2.4 (from versions: none)
207.1 ERROR: No matching distribution found for Django<3.3,>=3.2.4


Dockerfile:11

10 |
11 | >>> RUN python -m venv /py &&
12 | >>> /py/bin/pip install --upgrade pip &&
13 | >>> /py/bin/pip install -r /tmp/requirements.txt &&
14 | >>> rm -rf /tmp &&
15 | >>> adduser
16 | >>> --disabled-password
17 | >>> --no-create-home
18 | >>> django-user
19 |

ERROR: failed to solve: process "/bin/sh -c python -m venv /py && /py/bin/pip install --upgrade pip && /py/bin/pip install -r /tmp/requirements.txt && rm -rf /tmp && adduser --disabled-password --no-create-home django-user" did not complete successfully: exit code: 1

@haiderkn
Copy link

haiderkn commented Jan 7, 2024

Alhamdulillah!

Finally,I solved this issue on my own. It was not any with my computer, ubuntu, docker, or anything. The problem was with the shared local network I was using. 443 port is blocked for an unknown reason, so I used the internet from a SIM card operator. Then everything worked fine.

Thanks.

@sromkey
Copy link
Contributor

sromkey commented Jan 8, 2024

Thank you for reporting the issue as well as your resolution! Glad it worked out for you :)

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

No branches or pull requests

3 participants