<p>I recently upgraded Docker for Mac to v18.06 and noticed it can run a local k8s cluster. I was excited to try it out and ran one of our services via <code>kubectl apply -f deployments/staging/tom.yml</code>. The yml manifest does not have a restart policy specified. I then shut it down using <code>kubectl delete -f ...</code>. Since then, each time I start docker that container is starting automatically. Here is the output of <code>docker ps</code>, truncated for brevity</p>

<pre><code>CONTAINER ID    IMAGE            COMMAND                  CREATED             NAMES
2794eae1f31e    b06778bfe205     "/bin/sh -c 'java -c…"   27 minutes ago      k8s_tom-joiner_tom-joiner-66fcfd84bc...
8dd19dd65486    b06778bfe205     "/bin/sh -c 'java -c…"   27 minutes ago      k8s_tom-loader_tom-loader-6cb9f7f4fb...
...
</code></pre>

<p>However, the image is not managed by Kubernetes, so I cannot do <code>kubectl delete -f</code></p>

<pre><code>kubectl get pods
No resources found.
</code></pre>

<p>How do I permanently shut down the image and prevent if from restarting automatically? I tried <code>docker update --restart=no $(docker ps -a -q)</code> with no luck</p>

mbatchkarov
<p>This depends on your specific deployment, but <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy" rel="noreferrer">Kubernetes specifices that</a></p>

<blockquote>
  <p>A PodSpec has a <code>restartPolicy</code> field with possible values <code>Always</code>, <code>OnFailure</code>, and <code>Never</code>. The default value is <code>Always</code>. [...]</p>
</blockquote>

<p>So, if you don't want your pod to restart for any reason, you have to explicitly tell it not to. You don't provide the example contents of your YAML file so I cannot guess the best place to do that, but that's enough for general guidance I think.</p>

<hr>

<p>Now, for the problem that you face: Docker is probably using a custom namespace. Use</p>

<pre><code>kubectl get namespaces
</code></pre>

<p>to see what you get, then search for pods in those namespaces with</p>

<pre><code>kubectl -n &lt;namespace&gt; get pods
</code></pre>

<p>Or if you're impatient just get it over with:</p>

<pre><code>kubectl --all-namespaces get pods
</code></pre>

<p>Reference: <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#viewing-finding-resources" rel="noreferrer">kubectl cheat sheet</a></p>
