I am trying to run a deployment using prefect Docker. But for some reason it doesn’t run
Here is my docker block
prefect_docker_block = "de-prefect-docker"
def create_docker_image() -> None:
docker = DockerContainer(
image=PREFECT_DOCKER_IMAGE,
image_pull_policy="ALWAYS",
auto_remove=True,
)
docker.save(prefect_docker_block, overwrite=True)
def deploy_docker_container(docker_container_block) -> None:
deployment = Deployment.build_from_flow(
flow=main,
name="de-prefect-docker",
infrastructure=docker_container_block,
path="",
parameters={"prefix": "2022-04-15", "history_file": "null"},
entrypoint="scripts/gcs_to_bq.py:main",
ignore_file=".prefectignore",
skip_upload=True,
)
deployment.apply()
if __name__ == "__main__":
# load_dotenv()
PREFECT_DOCKER_IMAGE = os.environ.get("PREFECT_DOCKER_IMAGE")
create_docker_image()
# deploy job on Docker image
docker_container_block = DockerContainer.load(prefect_docker_block)
deploy_docker_container(docker_container_block)
I execute the block like so
python scripts/prefect_flow_via_docker.py
Then run the deployment
prefect deployment run main/de-prefect-docker
But I receive this message
Deployment 'main/de-prefect-docker' not found!
My Docker file
FROM python:3.8.3
ARG PREFECT_API_KEY
ENV PREFECT_API_KEY=$PREFECT_API_KEY
ARG PREFECT_API_URL
ENV PREFECT_API_URL=$PREFECT_API_URL
ARG GCP_DATASET_NAME
ENV GCP_DATASET_NAME=$GCP_DATASET_NAME
ARG GCP_DATASET_TABLE_NAME
ENV GCP_DATASET_TABLE_NAME=$GCP_DATASET_TABLE_NAME
ARG GCP_PROJECT_ID
ENV GCP_PROJECT_ID=$GCP_PROJECT_ID
ARG GCP_REGION
ENV GCP_REGION=$GCP_REGION
COPY poetry.lock .
COPY pyproject.toml .
RUN pip install poetry --trusted-host pypi.python.org --no-cache-dir
RUN poetry config virtualenvs.create false
RUN poetry install --no-root --without dev
RUN mkdir scripts
COPY scripts/ scripts/
In Prefect Cloud UI, I can see that the docker container has been created. But I not sure what I am missing. Any idea?