I've set up localstack running on docker. I have a .Net Core 2.1 c# Lambda function that is trying to connect to a MySql database on localhost. This is what I get in the console:
"Unable to connect to any of the specified MySQL hosts"
This is what my connection string looks like:
"Data Source=localhost;Initial Catalog=xxx;Host=localhost;Connection Timeout=10;User ID=xxxx;Password=xxxx;SSL Mode=none"
I've tried various IP addresses (127... etc) including our live DB connection string.
EDIT (23-Apr-2019): Command I run on the localstack folder:
docker-compose up
Here's the docker file I'm using:
version: '2.1'
services: localstack:
image: localstack/localstack
ports:
- "4567-4593:4567-4593"
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
environment:
- SERVICES=lambda,sqs,dynamodb,s3
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
- PORT_WEB_UI=${PORT_WEB_UI- }
- LAMBDA_EXECUTOR=docker-reuse
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"