docker / docker/docker-py

Client.api.build fails if Dockerfiles contains COPY --chmod=

Open
#2,916 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

When I'm using this Dockerfile, the Build exits without an Error but does not execute everything after the COPY statement. Im using the client.api.build function. When I build the Image with the docker cli everything works fine.

FROM centos

USER root

COPY --chown=users:test --chmod=0755 ./test /opt/test

USER test

This Dockerfile works fine:

FROM centos

USER root

COPY --chown=users:test ./test /opt/test

RUN chmod -R +x /opt/test

USER test

Expected behavior:

Docker SDK should behave like the docker cli. It should be possible to build the first Dockerfile.

The Testproject is here
pythonProject.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with client.api.build and the Dockerfile containing COPY --chown=users:test --chmod=0755, then compare its behavior with the Docker CLI. Trace how the SDK handles that COPY instruction; done means the build completes and executes the instructions after COPY, matching the CLI behavior.

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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.