Skip to content

Wrong files ownership in Dockerfile COPY #282

@adriantaut

Description

@adriantaut

RUN chown -R temporal:temporal /etc/temporal/config
USER temporal
these instructions are changing the /etc/temporal/config ownership to temporal user.

Afterwards, https://github.com/temporalio/docker-builds/blob/aced315717db95f3e79352d107680f68632ee07a/server.Dockerfile#L31C50-L31C71 are adding some files to /etc/temporal/config. Given how COPY works in Dockerfile, the root user will be the owner of this file unless explicitly defined with COPY --chown=temporal:temporal .......

How it affects us?

We are running Temporal in ECS and want to inject some dynamic configs in /etc/temporal/config/dynamicconfig/docker.yaml during startup time.

      "entryPoint": [
        "/bin/bash",
        "-c"
      ],
      "command": [
        "echo \"frontend.keepAliveMaxConnectionAge:\n  - value: 0\n    constraints: {}\" > /etc/temporal/config/dynamicconfig/docker.yaml && /etc/temporal/entrypoint.sh"
      ],

Unfortunately this returns Permission Denied unless we run the ECS Task with root user, and this is something we want to avoid if possible :)

Proposed changes

Either run the following command RUN chown -R temporal:temporal /etc/temporal/config after the COPY commands, or simply do the COPY with the COPY --chown=temporal:temporal ........

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions