docker.client.APIerror Client Error Not Found inside docker
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
Env WSL2 Ubuntu1804
dockerfile
RUN pip install colorama==0.3.1 requests docker==4.0.2 psutil
Exception in thread Thread-6:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/FrameworkBenchmarks/toolset/utils/docker_helper.py", line 155, in watch_container
for line in docker_container.logs(stream=True):
File "/usr/local/lib/python2.7/dist-packages/docker/models/containers.py", line 302, in logs
return self.client.api.logs(self.id, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/docker/api/container.py", line 853, in logs
output = self._get_result(container, stream, res)
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 451, in _get_result
return self._get_result_tty(stream, res, self._check_is_tty(container))
File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 447, in _check_is_tty
cont = self.inspect_container(container)
File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/docker/api/container.py", line 756, in inspect_container
self._get(self._url("/containers/{0}/json", container)), True
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 267, in _result
self._raise_for_status(response)
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/usr/local/lib/python2.7/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
NotFound: 404 Client Error: Not Found ("No such container: ba9ec13ceecc81280dd28c9bd3ce042b5e90ca602dd4941bc649d5c1fb54ea25")
docker_helper.py, line 150:156
def watch_container(docker_container, docker_file):
with open(
os.path.join(
run_log_dir, "%s.log" % docker_file.replace(
".dockerfile", "").lower()), 'w') as run_log:
for line in docker_container.logs(stream=True):
log(line, prefix=log_prefix, file=run_log)
I'm using last version (running through #https://github.com/docker/docker-py/issues/188)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docker_helper.py lines 150:156 and the watch_container function, then trace the docker_container.logs(stream=True) call through the traceback. Compare the reported behavior with docker-py issue #188 and determine the expected handling for the missing container. Done means the WSL2 reproduction no longer produces the reported unhandled NotFound error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100