Shufflepuff
Shufflepuff
WWindmill
Created by Shufflepuff on 11/16/2024 in #help
Run docker container in flow and curl against it
Heya, I'm trying to spin up a docker container as part of a flow and I want to wait for it to be available. Here's what I have so far, but it doesn't seem to be reachable via cURL from here.
# shellcheck shell=bash
# Bash script that calls docker as a client to the host daemon
# See documentation: https://www.windmill.dev/docs/advanced/docker
set -ex

port="${1:-3000}"

IMAGE="zfcsoftware/cf-clearance-scraper:latest"

# ensure that the image is up-to-date
docker pull $IMAGE
docker run \
--rm \
--name cf-clearance-scraper \
-d \
-p "$port":3000 \
-e PORT="$port" \
-e browserLimit=20 \
-e timeOut=60000 \
$IMAGE


# Wait for the container to be ready
while ! curl -s http://0.0.0.0:"$port" > /dev/null; do
echo "Waiting for Cloudflare Clearance Scraper..."
sleep 1
done

docker stop cf-clearance-scraper
# shellcheck shell=bash
# Bash script that calls docker as a client to the host daemon
# See documentation: https://www.windmill.dev/docs/advanced/docker
set -ex

port="${1:-3000}"

IMAGE="zfcsoftware/cf-clearance-scraper:latest"

# ensure that the image is up-to-date
docker pull $IMAGE
docker run \
--rm \
--name cf-clearance-scraper \
-d \
-p "$port":3000 \
-e PORT="$port" \
-e browserLimit=20 \
-e timeOut=60000 \
$IMAGE


# Wait for the container to be ready
while ! curl -s http://0.0.0.0:"$port" > /dev/null; do
echo "Waiting for Cloudflare Clearance Scraper..."
sleep 1
done

docker stop cf-clearance-scraper
Instead of 0.0.0.0 I've also already tried localhost and cf-clearance-scraper. Container is definitely running and exposing the port correctly:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
84facc2a4e61 zfcsoftware/cf-clearance-scraper:latest "docker-entrypoint.s…" 49 seconds ago Up 49 seconds 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp cf-clearance-scraper`
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
84facc2a4e61 zfcsoftware/cf-clearance-scraper:latest "docker-entrypoint.s…" 49 seconds ago Up 49 seconds 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp cf-clearance-scraper`
Any ideas are welcome 🙂 Thank you in advance!
1 replies