Docker image on k8s

By Raúl on Jul 1, 2022
Image courtesy of unsplash

Sometimes I need to sneak peek into a Docker image and inspect stuff.

I can run a Docker image in a k8s pod doing kubectl run NAME --image=IMAGE

kubectl run NAME --image=imageName

For instance

kubectl run hello-world --image=nginx-helloworld:latest --image-pull-policy=Never --port=80
kubectl port-forward pods/hello-world 8080:80

After completion, it’a a good idea to clean up.

So, I can delete the pod

kubectl delete pod hello-world 

if necessary remove the image from my registry.

# Remove the image
docker rmi nginx-helloworld:latest
2024. Personal website built with Astro & Streamline.