Failed build in gitlab CI/CD at requirements.txt - dockerfile

The gitlab build fails with the following error:
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/asgiref/
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/asgiref/
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/asgiref/
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/asgiref/
ERROR: Could not find a version that satisfies the requirement asgiref (from versions: none)
ERROR: No matching distribution found for asgiref
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Cleaning up file based variables
ERROR: Job failed: command terminated with exit code 1
My Dockerfile is the following:
FROM registry.ubitech.eu/public-group/ubitech-public-registry/python:3.8
COPY manage.py gunicorn-cfg.py requirements.txt ./
COPY core core
COPY routers routers
COPY data_utilities data_utilities
COPY datasets datasets
COPY monitoring monitoring
RUN pip install -r requirements.txt
COPY cron_3.0pl1-137_amd64.deb ./
RUN dpkg -i cron_3.0pl1-137_amd64.deb
RUN mkdir logs
RUN touch logs/onenet_dashboard.log
EXPOSE 5005
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]
It is the first time that the build fails. Any idea of what is going wrong here?

Related

my django file requirement.txt is installing while running in docker through cmd on my Window 10

Dockerfile:
FROM python:3.8-slim-buster
WORKDIR /main
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD python manage.py runserver
In my cmd/terminal:
E:\Satya_Django_TODO_APP\todo>docker build -t my_image --rm .
[+] Building 95.5s (8/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3.8-slim-buster 2.2s
=> [1/5] FROM docker.io/library/python:3.8-slim-buster#sha256:0b92aced9b0e52b16870a7c09 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 28.89kB 0.0s
=> CACHED [2/5] WORKDIR /main 0.0s
=> CACHED [3/5] COPY requirements.txt requirements.txt 0.0s
=> ERROR [4/5] RUN pip3 install -r requirements.txt 93.0s
------
> [4/5] RUN pip3 install -r requirements.txt:
#8 13.02 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f04029205e0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/aioredis/
#8 15.23 Collecting aioredis==1.3.1
#8 25.24 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f0402d7c4c0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /packages/b0/64/1b1612d0a104f21f80eb4c6e1b6075f2e6aba8e228f46f229cfd3fdac859/aioredis-1.3.1-py3-none-any.whl
#8 35.75 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f0402d7c730>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /packages/b0/64/1b1612d0a104f21f80eb4c6e1b6075f2e6aba8e228f46f229cfd3fdac859/aioredis-1.3.1-py3-none-any.whl
#8 46.77 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f0402d7c910>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /packages/b0/64/1b1612d0a104f21f80eb4c6e1b6075f2e6aba8e228f46f229cfd3fdac859/aioredis-1.3.1-py3-none-any.whl
#8 58.78 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f0402d7cb20>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /packages/b0/64/1b1612d0a104f21f80eb4c6e1b6075f2e6aba8e228f46f229cfd3fdac859/aioredis-1.3.1-py3-none-any.whl
#8 72.80 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f0402d7cca0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /packages/b0/64/1b1612d0a104f21f80eb4c6e1b6075f2e6aba8e228f46f229cfd3fdac859/aioredis-1.3.1-py3-none-any.whl
#8 82.81 ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/b0/64/1b1612d0a104f21f80eb4c6e1b6075f2e6aba8e228f46f229cfd3fdac859/aioredis-1.3.1-py3-none-any.whl (Caused by NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f0402d7ce50>: Failed to
establish a new connection: [Errno -3] Temporary failure in name resolution'))
#8 82.81
------
executor failed running [/bin/sh -c pip3 install -r requirements.txt]: exit code: 1
why my connection is not establishing ? i haven't found any exact answer till now

docker build network error when trying to pip install

I am building my first docker install as part of learning django. I have my docker install working. docker info is ok. and hello-world says successfull. But when I run the Dockerfile suggested by the turorial in my Django 3.0 Pro Book by Will Vincent. I get what look like a network dns error.
################
Error:
Step 6/7 : RUN pip install pipenv && pipenv install --system
---> Running in 585e5020f53a
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f339144df10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3391f05a90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3391f05e90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3391f05ad0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f33915ddd90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pipenv/
ERROR: Could not find a version that satisfies the requirement pipenv (from versions: none)
ERROR: No matching distribution found for pipenv
The command '/bin/sh -c pip install pipenv && pipenv install --system' returned a non-zero code: 1
####################
Dockerfile try to build:
Pull base image
FROM python:3.7
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /code
# Install dependencies
COPY Pipfile Pipfile.lock /code/
RUN pip install pipenv && pipenv install --system
# Copy project
COPY . /code/
It is failing on the RUN pip install.... line.
I have added dns nameserver entries directly into my /etc/resolver.conf file as other have suggested in my search here. not worked.
I assume there is some issue within Docker trying to run pip in the container? This is my first Docker install so exhausted search for answer.
On OS version Centos8
Thanks
bill sanderson
Ok, we can try a couple of things. First thing I would do:
In the Dockerfile add this(with google's dns):
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && pip install pipenv && pipenv install --system
It is important to do in the same RUN command.
Another option is:
docker build --network=host -t yourimage:yourversion .
I had the same issue last night - and this morning. Even after rebooting and trying to stop/start the service. This is on my Windows 10.
I did notice running a docker info output the following error:
Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified
As detailed here - https://stackoverflow.com/a/74098179/405022
Having ran wsl --shutdown and being prompted to restart docker desktop, I then proceeded to try my docker build.
docker build -f ./sources/service1/deploy/dev.dockerfile ./sources/service1 -t acme-app.service1-py:latest --no-cache --progress=plain
Coincidence? It worked for me in the end.

SSL error when installing django for python3

$ pip3 install django
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after
connection broken by 'SSLError(SSLError(185090184, '[X509] no certificate or crl found (_ssl.c:3732)'),)': /simple/django/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(185090184, '[X509] no certificate or crl found (_ssl.c:3732)'),)': /simple/django/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(185090184, '[X509] no certificate or crl found (_ssl.c:3732)'),)': /simple/django/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(185090184, '[X509] no certificate or crl found (_ssl.c:3732)'),)': /simple/django/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(185090184, '[X509] no certificate or crl found (_ssl.c:3732)'),)': /simple/django/
Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django
I have tried various solutions. I installed python3.7 and then tried but same.
I also tried this but the result was also same.
$ sudo apt-get install python3-setuptools ca-certificates
and same thing happens when I install django in a venv. Same goes for the installing a specific version of django.
I am using Ubuntu, yet, i solved this just running updates, then fixing dpkg configure -a, it seems installed all the certificates, then upgrade.

I got error while installing Django on pycharm

I am getting the following error while trying to install Django for python3
(base) C:\ShashiPractice ProjectStudent>pip install django
Collecting django
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
...
...
...
y failed: self signed certificate in certificate chain (_ssl.c:1056)')))
You made a small mistake.
The pip command is as follows:
pip install Django
Note that the the D in Django is in block letter. Hope this solves your problem :)

Error whenn installing awsebcli via Gitlab CLI

I have springboot project in gitlab that I try to deploy to Amazon Elastic Beanstalk environment that I created via Amazon web console.
In gitlab I am using Default shared Runners.
to deploy to AWS I must use 'eb' cli, for this I also need python
I tired to use this in my .gitlab-ci.yml
deploy:
stage: deploy
image: python:3.7.2-alpine3.7
script:
- pip install -r awsebcli
- eb use myenv-env -v
- eb deploy myenv-env -v
But got errors:
Pulling docker image python:3.7.2-alpine3.7 ...
Using docker image sha256:00be2573e9f79754b17954ba7a310a5f70c25b6f5bb78375e27e9e86d874877e for python:3.7.2-alpine3.7 ...
Running on runner-0c303413-project-4590-concurrent-0 via ed06f0845ef4...
Fetching changes...
Removing .m2/
Removing target/
HEAD is now at 5c19020 aws1
Checking out 5c190200 as master...
Skipping Git submodules setup
Checking cache for default...
Successfully extracted cache
Downloading artifacts for build (14719)...
Downloading artifacts from coordinator... ok id=14719 responseStatus=200 OK token=Yy7j2TGy
$ pip install -r awsebcli
Could not open requirements file: [Errno 2] No such file or directory: 'awsebcli'
ERROR: Job failed: exit code 1
Update
when I changed the line into:
pip3 install awsebcli
got:
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe6611ff2e8>: Failed to establish a new connection: [Errno -2] Name does not resolve')': /simple/awsebcli/
Could not find a version that satisfies the requirement awsebcli (from versions: )
No matching distribution found for awsebcli
The problem was proxy.
I added this:
pip3 --proxy=myProxy:myPort install awsebcli --upgrade