У меня фулстек приложение, я хочу поднять его в докере! Cобрал 3 контейнера для запуска проекта в докере: Клиент(Nuxt), Сервер(Node/Express), База(MariaDB)
При попытке приконектиться я получаю такую ошибку
Error: connect ECONNREFUSED 127.0.0.1:3006
Вот мой код
docker-compose.yaml
version: "3.7"
services:
server:
build: server/
command: [ "npm", "run", "dev" ]
ports:
- 3005:3005
volumes:
- .:/server
working_dir: /app
client:
build: client/
command: [ "npm", "run", "dev" ]
ports:
- 3000:3000
volumes:
- .:/client
working_dir: /app
depends_on:
- server
maria:
image: mariadb:latest
ports:
- 3006:3306
volumes:
- .:/migrate
working_dir: /var/lib/mysql
environment:
- MARIADB_ROOT_PASSWORD=nodejs
Настройки подключения к базе
"database" : {
"host" : "localhost",
"port" : "3006",
"user" : "nodejs",
"password" : "nodejs",
"database" : "travelpriceoff",
"insecureAuth": true,
"multipleStatements": true
}
Вот лог ответа в консоле когда пытаюсь дернуть базу данных
travelpriceoff-server-1 | Error: connect ECONNREFUSED 127.0.0.1:3006
travelpriceoff-server-1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
travelpriceoff-server-1 | --------------------
travelpriceoff-server-1 | at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
travelpriceoff-server-1 | at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
travelpriceoff-server-1 | at Connection.connect (/app/node_modules/mysql/lib/Connection.js:116:18)
travelpriceoff-server-1 | at Connection._implyConnect (/app/node_modules/mysql/lib/Connection.js:454:10)
travelpriceoff-server-1 | at Connection.query (/app/node_modules/mysql/lib/Connection.js:196:8)
travelpriceoff-server-1 | at /app/functions.js:13:24
travelpriceoff-server-1 | at new Promise (<anonymous>)
travelpriceoff-server-1 | at Object.returnDocumentHead (/app/functions.js:12:22)
travelpriceoff-server-1 | at /app/main.js:32:33
travelpriceoff-server-1 | at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) {
travelpriceoff-server-1 | errno: -111,
travelpriceoff-server-1 | code: 'ECONNREFUSED',
travelpriceoff-server-1 | syscall: 'connect',
travelpriceoff-server-1 | address: '127.0.0.1',
travelpriceoff-server-1 | port: 3006,
travelpriceoff-server-1 | fatal: true
travelpriceoff-server-1 | }
travelpriceoff-server-1 |
travelpriceoff-server-1 | Node.js v18.12.1
travelpriceoff-server-1 | [nodemon] app crashed - waiting for file changes before starting...
Я в Docker новичек, так что могу что-то не понимать, возможно я допустил ошибку, но не могу понять где именно