2024/03/25 12:14:52 Image node:latest found: false
2024/03/25 12:14:52 Pulling image node:latest...
2024/03/25 12:14:53 Creating container exec-test...
2024/03/25 12:14:53 failed to spawn container: %!w(*fmt.wrapError=&{Error creating container: Error response from daemon: No such image: node:latest {0xc000240120}})
The problem is due to the fact that ImagePull is an async function and according to the docs:
// ImagePull requests the docker host to pull an image from a remote registry.
// It executes the privileged function if the operation is unauthorized
// and it tries one more time.
// It's up to the caller to handle the io.ReadCloser and close it properly.
Closes #11, Closes #2
The problem is due to the fact that ImagePull is an async function and according to the docs:
This means that we never actually wait for the image to be downloaded and simply continue with the flow even if the container is still downloading. https://github.com/semanser/codel/blob/7a7ba36a9511f9dc31549112cfab0f1fb44e459f/backend/executor/executor.go#L58-L62