`Cannot locate specified Dockerfile` error when building images
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
docker-py version: 3.5
Python version: 3.6.5
Docker version: Docker version 18.06.0-ce, build 0ffa825, Linux container mode on Windows
OS: Windows 10 Version 1803 Build 17134.228
Steps to reproduce:
git clone https://github.com/LazarusX/docker-py-repro.gitcd docker-py-reprovirtualenv venv.\venv\Scripts\activate.ps1pip install -r requirements.txtpython main.py- See below errors:
Tag: my-hello-world
Context path: C:\Users\<username>\Projects\docker-py-repro
Dockerfile path: C:\Users\<username>\Projects\docker-py-repro\folder\folder\Dockerfile
Traceback (most recent call last):
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\api\client.py", line 229, in _raise_for_status
response.raise_for_status()
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\requests\models.py", line 939, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localnpipe/v1.35/build?t=my-hello-world&q=False&nocache=False&rm=False&forcerm=False&pull=False&dockerfile=folder%5Cfolder%5CDockerfile
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\main.py", line 15, in <module>
docker_client.images.build(tag=tag, path=context, dockerfile=dockerfile)
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\models\images.py", line 264, in build
for chunk in internal_stream:
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\utils\json_stream.py", line 66, in split_buffer
for data in stream_as_text(stream):
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\utils\json_stream.py", line 22, in stream_as_text
for data in stream:
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\api\client.py", line 320, in _stream_helper
yield self._result(response, json=decode)
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\api\client.py", line 235, in _result
self._raise_for_status(response)
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\api\client.py", line 231, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "C:\Users\<username>\Projects\docker-py-repro\venv\lib\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("Cannot locate specified Dockerfile: folder\folder\Dockerfile")
Building using Docker CLI with the same parameters worked successfully.
Workaround:
- Comment the
docker_client.images.build(tag=tag, path=context, dockerfile=dockerfile)line python main.py
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 the linked docker-py-repro repository and run main.py on the reported Windows and Docker versions. Trace the docker_client.images.build call and compare its Dockerfile path request with the Docker CLI behavior; done means the same nested Dockerfile builds successfully through the Python library.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100