Core: Can't connect to Mysql Docker Container

Created on 21 Jan 2017  Â·  8Comments  Â·  Source: adonisjs/core

This is my mysql configuration inside .env file

DB_CONNECTION=mysql
DB_HOST=192.168.99.100:32772
DB_DATABASE=adonis
DB_USER=xxx
DB_PASSWORD=xxx

I got this error

$ ./ace migration:run
Error: getaddrinfo ENOTFOUND 192.168.99.100:32772 192.168.99.100:32772:3306

Can you help me?

Most helpful comment

@navdeepsingh Here is a possible solution, but I think you should have opened another issue, the first reason is because this one is closed, so not many people see your question, the second reason is because it is not the same problem, this one is about the db and your problem is about the http conecction. I was having the same issue and solve it by removing the HOST key from the .env file or changing its value to 0.0.0.0, it worked for me.

All 8 comments

Host and port needs to be different

DB_HOST=192.168.99.100
DB_Port=32772
$ ./ace migration:run
Error: connect ECONNREFUSED 192.168.99.100:3306

Still confused, DB_PORT variable seems does not work.

Yes coz the config file is not using it. you need to define it in config/database.js file

Success, you should add this to documentation, or default code. Thank you so much

$ ./ace migration:run
√ Database migrated successfully in 504 ms

@thetutlage i create pull request for this https://github.com/adonisjs/adonis-app/pull/53 , very happy with this framework, thank you 😄

@arryanggaputra Can't able to run fresh install of adonis into docker.

  1 # Define the image
  2 FROM node:6.3
  3
  4 ENV NODE_ENV development
  5 ENV APP_PATH /usr/src/app
  6
  7 # Create the app directory
  8 RUN mkdir -p $APP_PATH
  9
 10 # Bundle app source
 11 COPY . $APP_PATH
 12 COPY .env $APP_PATH
 13 WORKDIR $APP_PATH
 14
 15 # Install
 16 RUN npm install
 17
 18 # Run it in port 3333
 19 EXPOSE 3333
 20
 21 # Start it
 22 CMD [ "npm", "start" ]

And tried to run image as
docker run -p 44444:3333 -d singhnavdeep/adonis-fresh

But not running. Any clue?

@navdeepsingh Here is a possible solution, but I think you should have opened another issue, the first reason is because this one is closed, so not many people see your question, the second reason is because it is not the same problem, this one is about the db and your problem is about the http conecction. I was having the same issue and solve it by removing the HOST key from the .env file or changing its value to 0.0.0.0, it worked for me.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Extarys picture Extarys  Â·  4Comments

blendsoft picture blendsoft  Â·  3Comments

navdeepsingh picture navdeepsingh  Â·  3Comments

ghost picture ghost  Â·  3Comments

GianCastle picture GianCastle  Â·  3Comments