--docker-network parmeter not working correctly #7732
Labels
area/docker
area/local/start-api
sam local start-api command
stage/bug-repro
The issue/bug needs to be reproduced
Hello!
Description:
I'm developing some lambdas with golang, and I'm trying to connect to a postres DB, however, the lambdas are not able to connect to my local development database.
The database is running in another container, but I created a docker network and I haven't had any luck connecting to the DB from the local running lambda.
Steps to reproduce:
Im creating the network and DB as the following:
Now, to start the API, I'm doing
sam local start-api --docker-network 72a7d526bfc1ea9f0556b8349539d256c7519d05143920087dec0e05f2d73e450
Then in the lambdas when I invoke them, they say
2024/11/22 18:29:18 Failed to ping the database: dial tcp [::1]:5432: connect: connection refused
And if I do a
docker network inspect 72a7d526bfc1ea9f0556b8349539d256c7519d05143920087dec0e05f2d73e450
I only see the DB container connected to that network.Observed result:
When I call my endpoint I get
2024/11/22 18:29:18 Failed to ping the database: dial tcp [::1]:5432: connect: connection refused
Expected result:
I'd except this to be listed under my
docker network inspect
command.However, it is not showing there. Also I'd expect to be able to connect from the lambda to my DB.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.78.0The text was updated successfully, but these errors were encountered: