Ognjen Nikolic
10/14/2020, 11:01 PMcluster = FargateCluster(
image="<http://xxxxxxxxx.dkr.ecr.us-west-2.amazonaws.com/prefect-dask:latest|xxxxxxxxx.dkr.ecr.us-west-2.amazonaws.com/prefect-dask:latest>",
scheduler_cpu=1024,
scheduler_mem=4096,
worker_cpu=256,
worker_mem=512,
cloudwatch_logs_group="prefect-dask-test",
task_role_policies=['arn:aws:iam::aws:policy/AmazonS3FullAccess',
'arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess']
)
# Prefect task definitions
create_container = CreateContainer(
image_name="ubuntu",
command="ls",
volumes=['/var/run/docker.sock', '/var/run/docker.sock']
)
start = StartContainer()
logs = GetContainerLogs()
wait = WaitOnContainer()
# Prefect Flow definition
with Flow("Prefect Test Workflow") as flow:
container_id = create_container()
start = start(container_id=container_id)
wait = wait(container_id=container_id)
logs = logs(container_id=container_id)
logs.set_upstream(wait)
state = flow.run(executor=DaskExecutor(address=cluster.scheduler_address))
Error encountered:
[2020-10-14 22:45:03] INFO - prefect.TaskRunner | Task 'CreateContainer': Starting task run...
[2020-10-14 22:45:03] ERROR - prefect.TaskRunner | Unexpected error: DockerException("Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))")
Any help would be greatly appreciated for how to correctly run Docker images as tasks within Prefect on FargateCluster.nicholas
DockerException("Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))")
is a Docker-specific error that's usually a result of the Docker service/daemon not being available. Can you confirm the docker daemon is running on your local machine by running something like docker ps
from your command line?Ognjen Nikolic
10/14/2020, 11:29 PMubuntu@ip-172-31-11-141:~/prefect$ docker run -ti --entrypoint /bin/bash -v /var/run/docker.sock:/var/run/docker.sock prefect-dask:latest
root@39c81c103d3f:/# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39c81c103d3f prefect-dask:latest "/bin/bash" 3 seconds ago Up 2 seconds serene_lichterman
ubuntu@ip-172-31-11-141:~/prefect$ docker run -ti --entrypoint /bin/bash prefect-dask:latest
root@b5f99f5ea304:/# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
nicholas
docker-py
create container method might not be starting the daemon as your CI command is doing; is it possible for you to ensure the Docker service is started in your container ahead of time (maybe an upstream task could handle this?) and we can test from there?Ognjen Nikolic
10/15/2020, 11:47 PMZanie