Is there a way to download the container image from a pod in kuberentes environment?

3/25/2018

Is there a way to download the container image from kuberentes pod? Let say we have multiple containers running in a Pod and we want to download the container so we can do some stuff offline in that container. The reason we want to download from kubernets pod directly since most of the environment settings are already set and the container should able to start with a single docker command.

It is like asking docker compose file from the kubernetes pod environment.

-- user1595858
docker-compose
kubernetes

1 Answer

3/26/2018

You cannot do it by Kubernetes itself, by any special command, etc. Here is a discussion about it.

But you still can use docker commit command right on the node and save a state of your container as a new image like that:

  1. Get container's ID, and node where it is running in detailed pod information: kubectl describe $POD. You need Container ID and Node values.
  2. Connect to a node which you got on a previous step and call: docker commit $CONTAINER_ID saved-image:1.
-- Anton Kostenko
Source: StackOverflow