How do I point to github registry for this step? ...
# ask-community
c
How do I point to github registry for this step?
Copy code
push:
  - prefect_docker.deployments.steps.push_docker_image:
      id: build-image
      requires: prefect-docker
      image_name: "{{ build-image.image_name }}"
      tag: "{{ build-image.tag }}"
      credentials: "{{ prefect.blocks.github-credentials.container-registry }}"
Any ideas on this?
k
you should be able to push to any image registry provided you're authenticated to it
the image name should include the registry url
c
Is there a prefect.yaml example of this? I am doing: build: - prefect_docker.deployments.steps.build_docker_image: id: build-image requires: prefect-docker image_name: testing/main tag: prod dockerfile: DockerFile push: - prefect_docker.deployments.steps.push_docker_image: id: build-image requires: prefect-docker image_name: “ghcr.io/Cruppelt/{{ build-image.result.image_name }}” tag: “{{ build-image.tag }}” credentials: “{{ prefect.blocks.github-credentials.container-registry }}” which is used by the prefect deploy --all in a GH action
Putting the registry there seems to be hitting the wrong url Traceback (most recent call last): 387 File “/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/docker/api/client.py”, line 268, in _raise_for_status 388 response.raise_for_status() 389 File “/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/requests/models.py”, line 1021, in raise_for_status 390 An exception occurred. 391 raise HTTPError(http_error_msg, response=self) 392 requests.exceptions.HTTPError: 404 Client Error: Not Found for url: /v1.43/images/ghcr.io/Cruppelt/push?tag=prod
k
the registry url should be in the name of the image you build, then reuse that name when you push
c
That seems to use the wrong url too? requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.43/images/sha256:cf3afef313a5e88e83ed3117130a285a8ae78ecf76e72389f56263e7526b4e55/tag?tag=prod&repo=ghcr.io%2FCruppelt%2Ftesting%2Fmain&force=0
^In the build_docker_image step
k
what image name are you using?
c
k
try dropping the https://
👍 1
c
I now get OSError: unauthorized: unauthenticated: User cannot be authenticated with the token provided. The token is valid though. is using this correct? credentials: “{{ prefect.blocks.github-credentials.container-registry }}”
k
can you try logging in to docker separately in your terminal
like this
and then remove the credentials field entirely and try deploying again
c
What do you mean remove credentials field? This works locally echo “REDACTED” | docker login ghcr.io --username cruppelt --password-stdin
nvrm that worked now with a separate docker step in the action and removing the credential block, now the deployment step 🙂
👍 1