skip to Main Content

In dockerfile:

ADD –chown=x:y /path/to/a/file /path/in/container

I understand ADD is used for copying files in container. chown is linux way of changing file ownership.

What does the x and y(represented as placeholders here) mean?

2

Answers


  1. As mentioned in the comments, the answer is in the Dockerfile reference documentation for ADD instruction:

    ADD [--chown=<user>:<group>] [--chmod=<perms>] [--checksum=<checksum>] <src>... <dest>
    ADD [--chown=<user>:<group>] [--chmod=<perms>] ["<src>",... "<dest>"]
    
    Login or Signup to reply.
  2. chown = "change owner". It’s the standard util for changing file owner & group on GNU/Linux.

    In chown x:y /path/to/file, x is the Unix user (user name or UID), and y is the Unix group (group name or GID). See https://manned.org/chown.

    Here Docker borrows its standard syntax to do the same thing.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search