Docker Community Forums

Share and learn in the Docker community.

COPY --chown fails in automated build: "Unknown flag: chown"


(Mbdevpl) #1

Hello, I’m using Docker Cloud automated builds feature on few repos, and in general it’s working without issue… However, I have this one Dockerfile, which builds fine on my machine, but fails when building on Docker Cloud, when using the command:

COPY --chown=user:user . /home/user/Projects/transpyle

with error:

Unknown flag: chown
ERROR: Build failed: Unknown flag: chown
ERROR: Build failed with exit code 2
ERROR: Build in 'ubuntu16.04' (de879021) failed in 0:08:38

Full log here:

Is Docker on Docker Cloud outdated or something? On my local machines (Ubuntu and Mac) I’m using up to date Docker, and I’m not facing any issues like that.

(Sam) #2

the doc for COPY doesn’t mention --chown

(Mbdevpl) #3

Indeed the docs don’t mention it. However it exists in Docker since version 17.09:

And I’m using 17.09 on my computers.

It looks like both docker on Docker Cloud and the docs are outdated…

(Mbdevpl) #4

Oh well… I changed my command:

COPY --chown=user:user . /home/user/Projects/transpyle

Into the more verbose legacy version:

COPY . /home/user/Projects/transpyle
RUN sudo chown -R user:user /home/user/Projects/transpyle

And now it works also on the cloud. Maybe one day they’ll update it too :confused:

(Jjaekel) #5

Docker Cloud service has still the issue.

Step 17/24 : COPY --from=logstash --chown=1000:1000 /target /usr/share/logstash

Unknown flag: chown

The workaround mentioned above does not work if chown is not available in the image :confused: Any chance to update?

(Sam) #6

Install chown into the image if u need it