I have a Dockerfile with a following configuration:
# Use an official Python 3.9 image as the base imageFROM python:3.9# Set the working directory to /appWORKDIR /app# Copy the requirements.txt file into the container at /appCOPY requirements.txt /app/# Install any needed packages specified in requirements.txtRUN pip install -r requirements.txt# Copy the web.py file into the container at /appCOPY web.py /app/# Make port 7860 available to the world outside this containerEXPOSE 7860# Define the command to run your applicationCMD ["python", "web.py"]
I am using the following command to build the image: docker build -t myimage .
But I get the following errors:
=> ERROR [webapp 4/5] RUN pip install -r requirements.txt 2.2s------> [webapp 4/5] RUN pip install -r requirements.txt:1.804 Collecting huggingface_hub==0.18.01.876 Downloading huggingface_hub-0.18.0-py3-none-any.whl (301 kB)1.886 ERROR: Exception:1.886 Traceback (most recent call last):1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper1.886 status = run_func(*args)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper1.886 return func(self, options, args)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 419, in run1.886 requirement_set = resolver.resolve(1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve1.886 result = self._result = resolver.resolve(1.886 File "/usr/local/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve1.886 state = resolution.resolve(requirements, max_rounds=max_rounds)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve1.886 self._add_to_criteria(self.state.criteria, r, parent=None)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria1.886 if not criterion.candidates:1.886 File "/usr/local/lib/python3.9/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__1.886 return bool(self._sequence)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__1.886 return any(self)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>1.886 return (c for c in iterator if id(c) not in self._incompatible_ids)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built1.886 candidate = func()1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link1.886 self._link_candidate_cache[link] = LinkCandidate(1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 297, in __init__1.886 super().__init__(1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in __init__1.886 self.dist = self._prepare()1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare1.886 dist = self._prepare_distribution()1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 308, in _prepare_distribution1.886 return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 491, in prepare_linked_requirement1.886 return self._prepare_linked_requirement(req, parallel_builds)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 536, in _prepare_linked_requirement1.886 local_file = unpack_url(1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 166, in unpack_url1.886 file = get_http_url(1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 107, in get_http_url1.886 from_path, content_type = download(link, temp_dir.path)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/network/download.py", line 147, in __call__1.886 for chunk in chunks:1.886 File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py", line 52, in _rich_progress_bar1.886 with progress:1.886 File "/usr/local/lib/python3.9/site-packages/pip/_vendor/rich/progress.py", line 1169, in __enter__1.886 self.start()1.886 File "/usr/local/lib/python3.9/site-packages/pip/_vendor/rich/progress.py", line 1160, in start1.886 self.live.start(refresh=True)1.886 File "/usr/local/lib/python3.9/site-packages/pip/_vendor/rich/live.py", line 132, in start1.886 self._refresh_thread.start()1.886 File "/usr/local/lib/python3.9/threading.py", line 899, in start1.886 _start_new_thread(self._bootstrap, ())1.886 RuntimeError: can't start new thread2.0402.040 [notice] A new release of pip is available: 23.0.1 -> 23.3.12.040 [notice] To update, run: pip install --upgrade pip------failed to solve: executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 2
It seems like it has something to do with pip installation of the packages.
- I am building docker image on Ubuntu 18.04
- Docker version: Docker version 20.10.7, build f0df350
- Docker compose version: v2.23.0