concourse / registry-image-resource

a resource for images in a Docker registry
Apache License 2.0
89 stars 107 forks source link

HOME directory is not writable for source image user #301

Open Berber31 opened 3 years ago

Berber31 commented 3 years ago

Executing a task with registry-image v1.4.0, the HOME directory is not writable for the user defined in the source image.

example:

jobs:
  - name: boxboat-kubectl
    plan:
      - in_parallel:

        - task: kubectl-registry-image-user-default-dans-home
          config:
            platform: linux
            image_resource:  
              type: registry-image
              source:
                repository: ((docker_poleemploi.registre))/boxboat/kubectl
                tag: 1.20.5
            run:
              path: /bin/sh
              args:
                - -euc
                - |       
                  id
                  ls -lart $HOME
                  echo "test" > $HOME/.kubeconfig

fails producing:

uid=1000(alpine) gid=1000(alpine)
total 8
drwxr-xr-x    3 root     root          4096 Sep 23 13:20 ..
drwxr-xr-x    2 root     root          4096 Sep 23 13:20 .

/bin/sh: can't create /home/alpine/.kubeconfig: Permission denied

However with docker-image resource it does not fail:

        - task: kubectl-docker-image    
          config:
            platform: linux
            image_resource:  
              type: docker-image
              source:
                repository: ((docker_poleemploi.registre))/boxboat/kubectl
                tag: 1.20.5
            run:
              path: /bin/sh
              args:
                - -euc
                - |             
                  id
                  ls -lart $HOME
                  echo "coucou" > $HOME/.kubeconfig    

success with:

uid=1000(alpine) gid=1000(alpine)
total 8
drwxr-xr-x    3 root     root          4096 Sep 23 08:55 ..
drwxr-sr-x    2 alpine   alpine        4096 Sep 23 08:55 .