apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  generateName: dind-sidecar-
spec:
  taskSpec:
    steps:
    - image: docker
      name: client
      script: |
          #!/usr/bin/env sh
          # Run a Docker container.
          docker run busybox echo hello

          # Write a Dockerfile and `docker build` it.
          cat > Dockerfile << EOF
          FROM ubuntu
          RUN apt-get update
          ENTRYPOINT ["echo", "hello"]
          EOF
          docker build -t hello . && docker run hello
          docker images

          # ...then run it!
          docker run hello
      volumeMounts:
      - mountPath: /var/run/
        name: dind-socket

    sidecars:
    # 18.09-dind seems to be the latest version of the image that works with
    # this example. The next released image, 19.03-dind doesn't work.
    - image: docker:18.09-dind
      name: server
      securityContext:
        privileged: true
      volumeMounts:
      - mountPath: /var/run/
        name: dind-socket

    volumes:
    - name: dind-socket
      emptyDir: {}

apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  generateName: dind-sidecar-
spec:
  taskSpec:
    steps:
    - image: docker
      name: client
      env:
      # Connect to the sidecar over TCP without TLS.
      - name: DOCKER_HOST
        value: tcp://localhost:2375
      script: |
          #!/usr/bin/env sh
          # Run a Docker container.
          docker run busybox echo hello

          # Write a Dockerfile and `docker build` it.
          cat > Dockerfile << EOF
          FROM ubuntu
          RUN apt-get update
          ENTRYPOINT ["echo", "hello"]
          EOF
          docker build -t hello . && docker run hello
          docker images

          # ...then run it!
          docker run hello
      volumeMounts:
      - mountPath: /var/run/
        name: dind-socket

    sidecars:
    - image: docker:dind
      name: server
      securityContext:
        privileged: true
      env:
      # This disables TLS for TCP connections between the sidecar and client step.
      - name: DOCKER_TLS_CERTDIR
        value: ''
      volumeMounts:
      - mountPath: /var/run/
        name: dind-socket

    volumes:
    - name: dind-socket
      emptyDir: {}

Update the dind sidecar example to use a recent dind image
Update the dind sidecar example to use a recent dind image

Some time after 18.09, Docker stopped communicating with its daemon
using the socket, and instead uses TCP. This example now uses TCP
accordingly, without TLS.
