Guest User

Untitled

a guest
Apr 12th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. db:
  2. image: mysql
  3. environment:
  4. MYSQL_ROOT_PASSWORD: <%= ENV['MYSQL_ROOT_PASSWORD'] %>
  5. ports:
  6. - "3306:3306"
  7.  
  8. web:
  9. build: .
  10. command: bundle exec rails s -p 3000 -b '0.0.0.0'
  11. volumes:
  12. - .:/myapp
  13. ports:
  14. - "3000:3000"
  15. links:
  16. - db
  17.  
  18. default: &default
  19. adapter: mysql2
  20. encoding: utf8
  21. pool: 5
  22. username: root
  23. password: <%= ENV['MYSQL_ROOT_PASSWORD'] %>
  24. host: <%= ENV['DB_PORT_3306_TCP_ADDR'] %>
  25. port: <%= ENV['DB_PORT_3306_TCP_PORT'] %>
  26.  
  27. development:
  28. <<: *default
  29. database: myapp_development
  30.  
  31. test:
  32. <<: *default
  33. database: myapp_test
  34.  
  35. production:
  36. <<: *default
  37. database: myapp_production
  38.  
  39. $ docker-compose up
  40. ...
  41. sidekiq_1 | Host '172.17.0.5' is not allowed to connect to this MySQL server
  42. ...
  43.  
  44. $ docker-compose run web env
  45. ...
  46. DB_PORT=tcp://172.17.0.3:3306
  47. DB_PORT_3306_TCP=tcp://172.17.0.3:3306
  48. DB_PORT_3306_TCP_ADDR=172.17.0.3
  49. DB_PORT_3306_TCP_PORT=3306
  50. DB_PORT_3306_TCP_PROTO=tcp
  51. WEB_PORT=tcp://172.17.0.6:3000
  52. WEB_PORT_3000_TCP=tcp://172.17.0.6:3000
  53. WEB_PORT_3000_TCP_ADDR=172.17.0.6
  54. WEB_PORT_3000_TCP_PORT=3000
  55. WEB_PORT_3000_TCP_PROTO=tcp
  56. ...
  57.  
  58. $ docker-machine ip myapp
  59. 192.168.99.100
  60.  
  61. Mysql2::Error
  62. Host '172.17.0.6' is not allowed to connect to this MySQL server
  63.  
  64. default: &default
  65. adapter: mysql2
  66. encoding: utf8
  67. pool: 5
  68. username: root
  69. password: <%= ENV['MYSQL_ROOT_PASSWORD'] %>
  70. host: db
  71. development:
  72. <<: *default
  73. database: myapp_development
  74.  
  75. test:
  76. <<: *default
  77. database: myapp_test
  78.  
  79. production:
  80. <<: *default
  81. database: myapp_production
  82.  
  83. default: &default
  84. adapter: mysql2
  85. encoding: utf8
  86. pool: 5
  87. username: root
  88. password:
  89. host: 127.0.0.1
Add Comment
Please, Sign In to add comment