Florent VanDeMoortele
05/29/2023, 4:03 PMprefect_docker
template to build a docker image and to push it on my private registry (on Gcloud) but it looks like it's not possible to use an other registry than docker. Any idea?
Otherwise, what's the best practice to deploy a docker image flow on a private storage?alex
05/29/2023, 4:10 PMdocker_build_image
this way internally.I expect we’ll add native support for more registry types in the future, but authenticating via the Docker CLI is the best way to do it right now.Florent VanDeMoortele
05/29/2023, 4:41 PMdocker.errors.APIError: 500 Server Error for <http+docker://localhost/v1.42/auth>: Internal Server Error ("Get "<https://eu.gcr.io/v2/>": unauthorized: Not Authorized.")
alex
05/29/2023, 4:49 PMFlorent VanDeMoortele
05/29/2023, 4:53 PMprefect.yaml
# build section allows you to manage and build docker images
build:
- prefect_docker.projects.steps.build_docker_image:
requires: prefect-docker
image_name: image_test
tag: dev
dockerfile: Dockerfile
push: True
credentials: "{{ prefect.blocks.docker-registry-credentials.dev-registry }}"
Florent VanDeMoortele
05/29/2023, 4:54 PM/Users/florent/.docker/config.json
alex
05/29/2023, 5:15 PMcredentials
so that the Docker client will use the credentials from your machine. Could you try again with your credentials
removed from your prefect.yaml
?Florent VanDeMoortele
05/30/2023, 3:48 PMcredentials
, how the flow can pull the image? When I launch this flow on the cloud UI, I have this error:
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/engine.py", line 276, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/client/utilities.py", line 40, in with_injected_client
return await fn(*args, **kwargs)
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/deployments.py", line 205, in load_flow_from_flow_run
output.update(await run_step(step))
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/projects/steps/core.py", line 78, in run_step
return await from_async.call_soon_in_new_thread(
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 181, in aresult
return await asyncio.wrap_future(self.future)
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 194, in _run_sync
result = self.fn(*self.args, **self.kwargs)
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/projects/steps/pull.py", line 26, in set_working_directory
os.chdir(directory)
FileNotFoundError: [Errno 2] No such file or directory
alex
05/30/2023, 3:50 PMFlorent VanDeMoortele
05/30/2023, 3:56 PMalex
05/30/2023, 3:59 PMdeployment.yaml
file, it’d look like this:
work_pool:
name: your-work-pool-name
job_variables:
image: {{ image_name }}
That will take the name of the created image output by the build_docker_image
step and set it on your deployment so that your Docker worker knows which image to pull.Florent VanDeMoortele
06/02/2023, 10:24 AMdocker.errors.ImageNotFound: 404 Client Error for <http+docker://localhost/v1.42/images/create?tag=e1c999a55b4e0eb28cc9db90a26c883bebd472423c89d25469bd0960c367c175&fromImage=sha256>: Not Found ("pull access denied for sha256, repository does not exist or may require 'docker login': denied: requested access to the resource is denied")
Florent VanDeMoortele
06/02/2023, 10:41 AM/usr/local/lib/python3.8/runpy.py:127: RuntimeWarning: 'prefect.engine' found in sys.modules after import of package 'prefect', but prior to execution of 'prefect.engine'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
10:39:47.126 | ERROR | Flow run 'swinging-grasshopper' - Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/engine.py", line 276, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/client/utilities.py", line 40, in with_injected_client
return await fn(*args, **kwargs)
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/deployments.py", line 194, in load_flow_from_flow_run
basepath = deployment.path or Path(deployment.manifest_path).parent
File "/usr/local/lib/python3.8/pathlib.py", line 1042, in __new__
self = cls._from_parts(args, init=False)
File "/usr/local/lib/python3.8/pathlib.py", line 683, in _from_parts
drv, root, parts = self._parse_args(args)
File "/usr/local/lib/python3.8/pathlib.py", line 667, in _parse_args
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
alex
06/02/2023, 3:07 PMprefect.yaml
or deployment.yaml
file. Do you have a pull step defined?Florent VanDeMoortele
06/02/2023, 3:33 PMprefect.projects.steps.set_working_directory
was missing, thank you @alex !!
Now it works when I launch locally my worker. I'll try to deploy a worker on my GCP infrastructure and to launch this flow. But I'm not sure of what I'm doing with new concepts on V2. On Prefect V1, I use to deploy an agent for each project and every flows of this project run with this agent. Have you an advice for Prefect V2?Florent VanDeMoortele
06/02/2023, 3:50 PM