-
-
Notifications
You must be signed in to change notification settings - Fork 9
Description
I'm running ecsta from within docker/docker-compose, to allow a separate docker-compose service to connect through ecsta to our dev database.
I.e. docker compose up backend-dev
boots up the backend-dev
service, which is the local backend code but with environment variables of DB_HOST/DB_PORT
set to the ecsta
service that is also running within docker-compose.
I have this working, but since ecsta
only binds to localhost
, when ran inside a docker container, nothing from the outside (even other docker services) could connect to it's --local-port
.
I was able to use socat to bind to 0.0.0.0:port
, have it forward to the localhost:port
which ecsta was listening on, and then from there the traffic goes out to the ECS remote port:
#!/bin/bash
set -e
echo "Starting socat to forward 0.0.0.0:$LOCAL_PORT to localhost:$SOCAT_PORT..."
socat TCP-LISTEN:$LOCAL_PORT,bind=0.0.0.0,reuseaddr,fork TCP:localhost:$SOCAT_PORT &
echo "Starting ecsta port forwarding..."
ecsta portforward --region $ECS_REGION --cluster $ECS_CLUSTER --family $ECS_FAMILY --container $ECS_CONTAINER --local-port $SOCAT_PORT --remote-port $REMOTE_PORT
So I'm all set, but just from a simplicity perspective, a command line flag like --public
or --local-address=0.0.0.0
would let me remove the socat
workaround from our setup.
Thanks for the great tool!