Hi guys, discovering prefect docker-work-pools, I encounter the following error when deploying a flo...
m
Hi guys, discovering prefect docker-work-pools, I encounter the following error when deploying a flow.
RuntimeError: This error is often thrown because Docker is not running. Please ensure Docker is running.
This is my code
Copy code
from flows import hello_world

if __name__ == "__main__":
    hello_world.deploy(
        "my-second-deployment",
        work_pool_name='docker-work-pool',
        interval=300,
        image='<http://registry.gitlab.com/<git-user>/<repo-name>:latest|registry.gitlab.com/<git-user>/<repo-name>:latest>',
    )
requirements.txt
Copy code
prefect==2.20.8
prefect-docker==0.5.5
requests==2.31.0
Could anyone assist me please ?
b
Hi Mehdi! Typically this happens when you don't have docker engine installed and running on your machine. Here's the doc we like to point people to. If you haven't installed it yet, do that first, and then try running your script again. Here's the Run flows in Docker containers guide as well.
m
Hi @Bianca Hoch I do have docker installed, and I use it daily 😅 I checked if it was a permission issue, but it wasnt. The closest thing I found was this thread
But then I used the recommanded version for the
requests
package but it didn't solve it
b
hmmm..what version of Prefect are you using? and where are you running your deployment script from? Locally?
Also- not to be that "turn it off and turn it on again" person, but have you tried closing out docker desktop and enabling it again to see if that changes anything?
I swore I had a similar issue in the past and that worked for me
m
Prefect 2.20.8, and yes the deployment script is run on my local machine
Will give it a try tomorrow
n
hi @Mehdi - the output of
docker info
might be useful context here
upvote 1
m
Hi @Nate there are the docker info result
Copy code
Client:
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.16.2-desktop.1)
  compose: Docker Compose (Docker Inc., v2.29.2-desktop.2)
  debug: Get a shell into any image or container (Docker Inc., 0.0.34)
  desktop: Docker Desktop commands (Alpha) (Docker Inc., v0.0.15)
  dev: Docker Dev Environments (Docker Inc., v0.1.2)
  extension: Manages Docker extensions (Docker Inc., v0.2.25)
  feedback: Provide feedback, right in your terminal! (Docker Inc., v1.0.5)
  init: Creates Docker-related starter files for your project (Docker Inc., v1.3.0)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scout: Docker Scout (Docker Inc., v1.13.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 10
 Server Version: 27.2.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8fc6bcff51318944179630522a095cc9dbf9f353
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.10.4-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 8
 Total Memory: 7.655GiB
 Name: docker-desktop
 ID: f2ca41e7-06e0-4ade-b750-b68458792391
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: <https://index.docker.io/v1/>
 Labels:
  com.docker.desktop.address=unix:///Users/myuser/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: You're not using the default seccomp profile
WARNING: daemon is not using the default seccomp profile
Hi @Nate thanks for the lead I managed to solve this, it was an issue when using docker desktop (macOS 😠) where you need to specify the
DOCKER_HOST
env_var
🚀 2
✨ 2
1. Run
docker context ls
and copy the used docker endpoint 2. set the docker endpoint to the env_var DOCKER_HOST by running:
Copy code
export DOCKER_HOST="unix:///Users/myuser/.docker/run/docker.sock"
thank you 1