luke b
11/02/2024, 3:49 AMFROM prefecthq/prefect:3-python3.11
WORKDIR /app
# Install poetry
RUN pip install poetry
# Copy poetry files
COPY pyproject.toml poetry.lock /app/
# Install dependencies
RUN poetry config virtualenvs.create false \
&& poetry install --no-dev --no-root
# Copy the source code
COPY src/ /app
# Run the application
CMD ["sh", "-c", "pwd && ls && python first_example.py"]
from prefect.deployments.runner import DockerImage
from src.first_example import run_first_example
def deploy_local():
run_first_example.deploy(name="example-local-deployment",
work_pool_name="local-docker-pool",
parameters={"a": 3},
image=DockerImage(
name="first-example",
tag="latest",
dockerfile="Dockerfile",
),
push=False
)
if __name__ == "__main__":
deploy_local()
docker.errors.ImageNotFound: 404 Client Error for <http+docker://localhost/v1.41/images/create?tag=latest&fromImage=first-example>: Not Found ("pull access denied for first-example, repository does not exist or may require 'docker login': denied: requested access to the resource is denied")
Nate
11/03/2024, 2:48 AMecs
type worker, instead of the docker
worker
if you're using cloud and don't need granular control on how your worker runs you can use an ecs push pool so you don't need to run a workerluke b
11/03/2024, 3:08 PMNate
11/03/2024, 8:42 PMcommand
field on your work pool
• as for the error, docker can’t find your image. i would use a remote registry for your image, but if you can’t, perhaps you can try an image tag other than latest? e.g “local”