buildkite-plugins / docker-buildkite-plugin

🐳📦 Run any build step in a Docker container
MIT License
113 stars 106 forks source link

Docker plugin results in <Segmentation fault> when run in GKE #140

Closed christian-roggia closed 2 years ago

christian-roggia commented 5 years ago

I am running the following very basic pipeline using the Docker plugin:

steps:
  - command: "go version"
    plugins:
      - docker#v3.3.0:
          image: "golang:1.11"

The agent is running in GKE with the following configuration (I tried both buildkite/agent:3-ubuntu and buildkite/agent:3 images):

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: buildkite-agent
  name: buildkite-agent
spec:
  replicas: 1
  selector:
    matchLabels:
      app: buildkite-agent
  template:
    metadata:
      labels:
        app: buildkite-agent
    spec:
      containers:
      - env:
        - name: BUILDKITE_AGENT_TOKEN
          valueFrom:
            secretKeyRef:
              key: token
              name: buildkite-agent
        image: buildkite/agent:3-ubuntu
        imagePullPolicy: Always
        name: buildkite-agent
        securityContext:
          privileged: true
        volumeMounts:
        - mountPath: /usr/bin/docker
          name: docker-binary
        - mountPath: /var/run/docker.sock
          name: docker-socket
        - mountPath: /root/.ssh/id_rsa
          name: ssh-keys
          subPath: id_rsa
        - mountPath: /root/.ssh/id_rsa.pub
          name: ssh-keys
          subPath: id_rsa.pub
      restartPolicy: Always
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - hostPath:
          path: /usr/bin/docker
        name: docker-binary
      - hostPath:
          path: /var/run/docker.sock
        name: docker-socket
      - name: ssh-keys
        secret:
          defaultMode: 256
          secretName: buildkite-agent-ssh

The logs from the build show that the following command is being executed (I beautified the command for more readability):

docker run -it
    --rm
    --init
    --volume /buildkite/builds/buildkite-agent-xxxxxxxx-xxxx-x/xxxx/xxxxx:/workdir
    --workdir /workdir
    --env BUILDKITE_JOB_ID
    --env BUILDKITE_BUILD_ID
    --env BUILDKITE_AGENT_ACCESS_TOKEN
    --volume /usr/local/bin/buildkite-agent:/usr/bin/buildkite-agent
    --label com.buildkite.job-id=xxxxxxxx-xxxxxx-xxxxxx-xxxxx-xxxxxxxx
        golang:1.11 /bin/sh -e -c go\ version

The command results in the following error no matter which configuration I try to use:

 /buildkite/plugins/github-com-buildkite-plugins-docker-buildkite-plugin-v3-3-0/hooks/command: line 385:   168 Segmentation fault      (core dumped) docker run "${args[@]}"

It looks like something is going wrong with the Docker instance, as additional information I am running the GKE version of Kubernetes 1.13.7-gke.8 with preemptible nodes enabled in europe-west3-a.

pzeballos commented 2 years ago

Hi @christian-roggia! Sorry for the long delay! 🙏🏻 Not sure if you are still interested 😅, but are you still having issues? We weren't able to reproduce this issue. Thanks!