Hello @Sachin
Goodday!
Alternatively, you can use Azure Container Registry (ACR) to store your Docker images. AKS supports the Docker image format, and you can integrate it with ACR for private storage of your Docker images. To create a private image store, see Azure Container Registry.
I think you can use kubectl cp
command to copy files from a running container to your local machine, including the Dockerfile and any other files you need to build the image.
Use the az acr build
command to build and push the image to an Azure Container Registry (ACR). This command builds the image from a Dockerfile, then pushes the image to an ACR.
Basically, Identify the pod and container you want to save, then use the below command to copy
kubectl cp <pod-name>:<container-path> <local-path>
Create a Dockerfile that includes the copied files. Build the Dockerfile and push the image to an ACR using the az acr build
command.
az acr build --image <image-name>:<tag> --registry <acr-name> --file <path-to-dockerfile> <path-to-context>
I believe that's it. Feel free to reach out for any queries.
If this does answer your question, please accept it as the answer as a token of appreciation.