Open uggla opened 8 years ago
Thanks @shin- for the prompt answer ! Sorry the doc is not so clear on that point.
So I need to pass a tar file which include my files + the Dockerfile into fileobj and set custom_context=True.
Do I understand well ? If yes, is it still possible to specify a specific Dockerfile name (ex : Dockerfile.debian)
Also looking for some clarification on this. Trying to pass a Dockerfile with fileobj using docker-py version 1.10.6. It fails with a error: lstat testfile: no such file or directory
but that file is definitely in the directory. I've tried to implement the custom_context param, but that errors with an unexpected EOF
I'm trying to implement with a simple script similar to the fileobj script above. Is this a bug or am i missing something in the documentation?
I faced with the same problem
dockerfile = f"""
FROM node:18-buster-slim as build-stage
WORKDIR /app
ADD /absolute/path/to/my/app.zip /app
RUN yarn && yarn run build
FROM nginx:stable-alpine as production-stage
WORKDIR /usr/share/nginx/html
COPY --from=build-stage /app/dist ./
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
"""
df = io.BytesIO(dockerfile.encode('utf-8'))
image = await run_in_threadpool(
client.images.build,
fileobj=df,
tag=f"{current_user.username}/{body.name}",
rm=True,
custom_context=False
)
I have got
docker.errors.BuildError: ADD failed: file not found in build context or excluded by .dockerignore: stat absolute/path/to/my/app.zip: file does not exist
if custom_context = True, then
raise BuildError(last_event or 'Unknown', result_stream) docker.errors.BuildError: {'message': 'unexpected EOF'}
Help to fix please
Based on documentation example, I modified the Dockerfile content. However the following code does not find python-redfish.src.tar.gz
It rises the following error,
Using the same content as the script into a Dockerfile
It builds correctly
This code as well
Investigating a bit more, I found that the context seems not managed correctly as soon as we use the fileobj parameter.
The files used : docker-py_debug.tar.gz