concourse-dcind icon indicating copy to clipboard operation
concourse-dcind copied to clipboard

Issue mounting files

Open vardy opened this issue 3 years ago • 1 comments

Hey, I'm getting this error mounting an nginx conf file into my container. I suspect the source of this error is the fact that I am running the docker-in-concourse commands on the docker daemon mounted from my host machine (see -H socat:1234) - I can't tell why this 'not a directory' error is occurring though.

docker-compose (concourse deployment) (to show how the daemon is mounted)

  socat:
    image: alpine/socat:1.0.3
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command:
      - TCP-LISTEN:1234,fork
      - UNIX-CONNECT:/var/run/docker.sock

docker-compose (pipeline'd project)

      volumes:
          - ./nginx.conf:/etc/nginx/nginx.conf:ro

Job:

- name: deploy
    serial: true
    plan:
      - get: git-repo
        trigger: true
        passed: [build]
      - task: deploy
        privileged: true
        config:
          platform: linux
          image_resource:
            type: docker-image
            source:
              repository: karlkfi/concourse-dcind
          inputs:
            - name: git-repo
          run:
            path: entrypoint.sh
            args:
              - bash
              - -ceux
              - |
                docker-compose -f git-repo/docker-compose.yml -H socat:1234 down
                docker-compose -f git-repo/docker-compose.yml -H socat:1234 up --build -d

Error:

ERROR: for git-repo_nginx_1 Cannot start service nginx: OCI runtime create failed: container_linux.go:349: 
starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: 
mounting \\\"/tmp/build/b0d51b9f/git-repo/nginx.conf\\\" to rootfs 
\\\"/var/lib/docker/overlay2/ad53263c3148bcc93b53a45b97a0fd3d3a3e60b92feca3d23965afd22cf23c19/merged\\\" at 
\\\"/var/lib/docker/overlay2/ad53263c3148bcc93b53a45b97a0fd3d3a3e60b92feca3d23965afd22cf23c19/merged/etc/nginx/nginx.conf\\\" 
caused \\\"not a directory\\\"\"": unknown: 
Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

vardy avatar Oct 26 '20 03:10 vardy

Hello, if your input dir is git-repo, and that isn't the workdir for the dcind container, then I'm not sure ./nginx.conf will make sense. perhaps specify a workdir in the run: object in concourse? Assuming you still have this problem (it's been a year and a half)

dannystaple avatar Feb 02 '22 11:02 dannystaple