Docker Q …
I’m trying to cache a number of other docker containers on Codespaces. So that when the codespace image is started, the other containers are ‘instantly’ available.
I’ve gotten this to work in the postCreateCommand, but that happens after VS code has started and can still take a while…
Thus the image may not be available when a user start to use their codespace in earnest.
I tried to add
Docker pull image --quiet
To the docker file of the codespace, but that seems to lead to an infinite loop, eventually crashing the codespace creation.
From image
User codespace
Run docker pull image --quiet
If I’m understanding correctly, the docker image shouldn’t be preloaded on the containers, but on the containers host… Anyone have a better idea on how to preload/cache the image other than waiting for the container to start and then running docker pull?
Is there any way to guarantee on which codespaces host your codespaces instance is spun up? If not I don’t think there is any way to cache the images because there’s no guarantee that the next codespaces image is spun up on the host that has previously pulled the images.
When I run docker pull some image:latest, inside of the codespace, that image is persisted, even when the codespace is stopped. It’s still available when the codespace resumes.
But adding the same command to the Docker file doesn’t seem to work.
Is it acceptable if the container is simply not-yet-ready while pulling, so the user cannot access it yet? In that case you could overwrite the exec command