few-byte-52729
04/28/2023, 1:55 PMartifacts = docker.Image(
"artifacts-image",
build=docker.DockerBuildArgs(
context="./artifacts",
dockerfile="artifacts/Dockerfile",
),
image_name="artifacts",
skip_push=True
)
artifacts_container = ContainerArgs(
name="artifacts-container",
image=artifacts.image_name,
)
deployment = Deployment(
"backend",
metadata=backend_metadata,
spec=DeploymentSpecArgs(
replicas=1,
selector=app_selector,
template=PodTemplateSpecArgs(
metadata=backend_php_metadata,
spec=PodSpecArgs(
volumes=[
],
init_containers=[
artifacts_container,
],
containers=[
],
),
),
),
)
pulumi up
gives me the message warning: [Pod backend-95bd4bd6-5c4c5f594c-bqb8t]: containers with incomplete status: [artifacts-container]
kubectl describe pod backend-95bd4bd6-5c4c5f594c-bqb8t
shows the error Failed to pull image "artifacts": rpc error: code = Unknown desc = Error response from daemon: pull access denied for artifacts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
but the image is shown by docker image ls
so it looks like it tries to get from some provider instead of locally. Is there a config somewhere to get images locally? https://github.com/pulumi/pulumi-docker/issues/148 was not really helpful or I must have missed something.salmon-account-74572
04/28/2023, 2:27 PMfew-byte-52729
04/28/2023, 5:52 PMeval $(minikube docker-env)
in the terminal I do pulumi up
. To no avail as it would have been too easy.
Next, let's register the image created with minikube.
artifacts = docker.Image(
"artifacts-image",
build=docker.DockerBuildArgs(
context="./artifacts",
dockerfile="artifacts/Dockerfile",
),
image_name="artifacts",
skip_push=True
)
os.system("minikube image load artifacts")
Little minikube image ls
and yup <http://docker.io/library/artifacts:latest|docker.io/library/artifacts:latest>
looks to be present. But the container can't pull it it seems.
Let's update its policy with
artifacts_container = ContainerArgs(
name="artifacts-container",
image=artifacts.image_name,
image_pull_policy="Never",
)
Still not enough. So yeah time to setup a local image repository.salmon-account-74572
04/28/2023, 7:49 PMskip_push
if you are just working locally with Docker (like building the image and then running a container from that image). The wrinkle here is Kubernetes. Sorry for the extra work of having to stand up a repository (there’s a quick-and-dirty registry you can run as a container, FWIW), but this is outside our control.few-byte-52729
04/29/2023, 2:43 PM