I'm trying to test aws lambda locally, but i cannot connect to mariadb in docker. My docker-compose file: [
version: "3.8"
services:
backup-cvt-dev-portal:
image: mariadb
container_name: gdziesiedzieje
environment:
- MARIADB_ROOT_PASSWORD=mariadb
ports:
- "5400:3306"
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
]1
url to DriverManager.getConnection(jdbcUrl); String jdbcUrl = "jdbc:mariadb://" + "localhost" + ":" + 3306 + "/" + "db001" + "?user=" + "root" + "&password=" + "mariadb";
i got: "SQLException:Could not connect to address\\u003d(host\\u003dlocalhost)(port\\u003d3306)(type\\u003dmaster) : Socket fail to connect to host:localhost, port:3306. Connection refused (Connection refused) SQLState:08000 VendorError:-1\
I create container with command: docker-compose up -d
It seems to me like port is not available, but i don't know how to fix it. I tried disable Windows firewall but it didn't work.