Can't pip install within owasp/zap2docker-stable:2.12.0 Docker container
See original GitHub issueDescribe the bug
Attempting to run pip install
with a handful of packages (including pip itself) fails due to a threading issue. Fails on both latest (aka 2.12.0) and 2.11.1:
circleci@ip-172-28-9-217:~$ docker run -it owasp/zap2docker-stable /bin/bash
zap@6cd9025295b1:/zap$ pip --version
pip 22.3 from /usr/lib/python3/dist-packages/pip (python 3.10)
zap@6cd9025295b1:/zap$ pip install wait-for-it
Defaulting to user installation because normal site-packages is not writeable
Collecting wait-for-it
Downloading wait_for_it-2.2.1-py3-none-any.whl (8.1 kB)
Collecting click
Downloading click-8.1.3-py3-none-any.whl (96 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/96.6 kB ? eta -:--:--ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 400, in run
requirement_set = resolver.resolve(
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
File "/usr/lib/python3/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/usr/lib/python3/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 373, in resolve
failure_causes = self._attempt_to_pin_criterion(name)
File "/usr/lib/python3/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
criteria = self._get_updated_criteria(candidate)
File "/usr/lib/python3/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 204, in _get_updated_criteria
self._add_to_criteria(criteria, requirement, parent=candidate)
File "/usr/lib/python3/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "/usr/lib/python3/dist-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
return bool(self._sequence)
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
return any(self)
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
candidate = func()
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 297, in __init__
super().__init__(
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in __init__
self.dist = self._prepare()
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare
dist = self._prepare_distribution()
File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 308, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 491, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 536, in _prepare_linked_requirement
local_file = unpack_url(
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 166, in unpack_url
file = get_http_url(
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 107, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "/usr/lib/python3/dist-packages/pip/_internal/network/download.py", line 147, in __call__
for chunk in chunks:
File "/usr/lib/python3/dist-packages/pip/_internal/cli/progress_bars.py", line 52, in _rich_progress_bar
with progress:
File "/usr/lib/python3/dist-packages/pip/_vendor/rich/progress.py", line 1165, in __enter__
self.start()
File "/usr/lib/python3/dist-packages/pip/_vendor/rich/progress.py", line 1156, in start
self.live.start(refresh=True)
File "/usr/lib/python3/dist-packages/pip/_vendor/rich/live.py", line 132, in start
self._refresh_thread.start()
File "/usr/lib/python3.10/threading.py", line 935, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't start new thread
Steps to reproduce the behavior
You can try other packages here besides wait-for-it
, I couldn’t get them to work.
docker run -it owasp/zap2docker-stable:latest /bin/bash -c "pip install wait-for-it"
Expected behavior
Successful install:
$ docker run -it owasp/zap2docker-stable:2.11.0 /bin/bash -c "pip install wait-for-it"
Creating tdrs-backend_zaproxy_run ... done
Defaulting to user installation because normal site-packages is not writeable
Collecting wait-for-it
Downloading wait_for_it-2.2.1-py3-none-any.whl (8.1 kB)
Requirement already satisfied: click in /usr/local/lib/python3.8/dist-packages (from wait-for-it) (4.0)
Installing collected packages: wait-for-it
Successfully installed wait-for-it-2.2.1
WARNING: You are using pip version 21.3.1; however, version 22.3 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
$
Software versions
$ docker --version Docker version 20.10.6, build 370c289
Screenshots
No response
Errors from the zap.log file
N/A zap binary seems to run ok
Additional context
This is also being run in CircleCI or my local Ubuntu VM.
Would you like to help fix this issue?
- Yes
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Can't install pip packages inside a docker container with Ubuntu
Log into Ubuntu as a user with sudo privileges. 2. Open the /etc/default/docker file for editing : $ sudo nano /etc/default/docker 3. Add...
Read more >owasp/zap2docker-stable:2.9.0 - Docker Hub
owasp /zap2docker-stable ... Image. Image Layers. 1. ADD file ... in /. 25.46 MB ... 12. /bin/sh -c echo zap:zap |. 401 B....
Read more >ZAP Docker User Guide
Docker image with OWASP Zed Attack Proxy preinstalled. Details. Install Instructions. Stable. The stable image is updated whenever there is a ZAP full ......
Read more >How to drive automated scans through the command line ...
I'm running this inside of an isolated network that can't reach outside and the system under test is another docker container on the...
Read more >Creating the Perfect Python Dockerfile | by Luis Sena | Medium
You can have a single Dockerfile to run tests and deploy. Install your testing and production requirements in different “folders” in the base ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmm, this is odd. My ubuntu VM this is successful; however, using CircleCI’s executor, this fails.
My VM OS:
Linux dev-VM 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
CircleCI executor OS:
Linux ip-########## 5.4.0-1045-aws #47-Ubuntu SMP Tue Apr 13 07:02:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Looks like we’re using an old ubuntu executor image for circleci. Will try updating to current/latest and trying this again. If successful, will probably be closing this out.
Thanks for letting us know.