Answer the question
In order to leave comments, you need to log in
Docker Nodejs ERROR: connect ECONNREFUSED 127.0.0.1:3306, how to connect to MySQL?
Hello!
I am developing a site on nodejs + express + sequelize-cli
There was a task for development to deploy everything through docker.
You need to run mysql, adminer, backend at startup Docker
-compose.yml file:
version: '3'
services:
backend:
build: ./backend
ports:
- 5000:5000
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_DATABASE: database_development
MYSQL_ROOT_PASSWORD: password_development
adminer:
image: adminer
restart: always
ports:
- 8080:8080
FROM node:latest
COPY . /app
WORKDIR /app
RUN npm install
RUN npx sequelize db:migrate
RUN npx sequelize db:seed:all
EXPOSE 5000
VOLUME .:/app
CMD npm run dev
Step 5/9 : RUN npx sequelize db:migrate
---> Running in 08fd366ceb86
Sequelize CLI [Node: 15.5.0, CLI: 6.2.0, ORM: 6.3.5]
Loaded configuration file "database/config.json".
Using environment "development".
ERROR: connect ECONNREFUSED 127.0.0.1:3306
npm ERR! code 1
npm ERR! path /app
npm ERR! command failed
npm ERR! command sh -c sequelize db:migrate
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-12-28T07_22_31_094Z-debug.log
ERROR: Service 'backend' failed to build : The command '/bin/sh -c npx sequelize db:migrate' returned a non-zero code: 1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question