<p>I'm setting up a kubernetes deployment with an image that will execute docker commands (<code>docker ps</code> etc.).</p>
<p>My yaml looks as the following:</p>
<pre><code>kind: Deployment
apiVersion: apps/v1
metadata:
  name: discovery
  namespace: kube-system
  labels:
    discovery-app: kubernetes-discovery
spec:
  selector:
    matchLabels:
      discovery-app: kubernetes-discovery
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        discovery-app: kubernetes-discovery
    spec:
      containers:
      - image: docker:dind
        name: discover
        ports:
        - containerPort: 8080
          name: my-awesome-port
      imagePullSecrets:
        - name: regcred3
      volumes:
      - name: some-volume
        emptyDir: {}
      serviceAccountName: kubernetes-discovery
</code></pre>
<p>Normally I will run a docker container as following:</p>
<p><code>docker run -v /var/run/docker.sock:/var/run/docker.sock docker:dind</code></p>
<p>Now, kubernetes yaml supports <code>commands</code> and <code>args</code> but for some reason does not support <code>options</code>.</p>
<p>What is the right thing to do?</p>
<p>Perhaps I should configure a volume, but then, is it volumeMount or just a volume?</p>
<p>I am new with kubernetes so it is important for me to do it the right way.</p>
<p>Thank you</p>

<p>You want to add the volume to the container.</p>

<pre><code>spec:
  containers:
  - name: discover
    image: docker:dind
    volumeMounts:
    - name: dockersock
      mountPath: "/var/run/docker.sock"
  volumes:
  - name: dockersock
    hostPath:
      path: /var/run/docker.sock  
</code></pre>
