4

In Concourse CI, by default, the underlying container for a job's task is instantiated and run with user root.

If the container used for my task needs to be executed with a different user (e.g. postgres), how can I do that in Concourse?

L Silva
  • 226
  • 1
  • 5

1 Answers1

6

Concourse tasks provide a user parameter to explicitly set the user to run its container as. See http://concourse-ci.org/running-tasks.html#task-run-user .

Here is a sample Concourse pipeline to demonstrate the use of that parameter:

---
jobs:
- name: check-container-user
  plan:
  - do:
    - task: container-user-postgres
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: postgres
            tag: "latest"
        run:
          user: postgres
          path: sh
          args:
          - -exc
          - |
            whoami
            echo "Container running with postgres user"
Dwayne Forde
  • 1,324
  • 13
  • 13
L Silva
  • 226
  • 1
  • 5