How to cache docker images with GitHub Codespaces devcontainer prebuild?

391 Views Asked by At

I'm using github codespaces and I have pre-built my devcontainer with feature kubernetes-helm-minikube which contains a minikube pre-installed in the dev container.

My question is, with prebuilding, my devcontainer users still have to download gcr.io/k8s-minikube/kicbase image when they run minikube start in a newly created codespace. Is there a way to cache the minikube start resources in the prebuild process? Or at least cache the gcr.io/k8s-minikube/kicbase image with prebuild?

Could anyone point out the right way to do that? Greatly appreciate any suggestions.

What I've tried:

"onCreateCommand": [
        "nohup bash -c 'minikube start &' > minikube.log 2>&1"
    ]

and the prebuild workflow failed with error $ nohup bash -c 'minikube start &' > minikube.log 2>&1 OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "nohup bash -c 'minikube start &' > minikube.log 2>&1": executable file not found in $PATH: unknown

  • I tried run docker pull gcr.io/k8s-minikube/kicbase:v0.0.36 on container create and similar error occurred: starting container process caused: exec: "docker pull gcr.io/k8s-minikube/kicbase:v0.0.36": stat docker pull gcr.io/k8s-minikube/kicbase:v0.0.36: no such file or directory: unknown

  • I tried run minikube start with postCreateCommand and the result made it clear that the postCreateCommand is only executed after the dev container has been assigned to a user, not during prebuild (as the prebuild doc states).

0

There are 0 best solutions below