rails-chat-tutorial
rails-chat-tutorial copied to clipboard
Unable to connect to mysql
Hello Iridakos,
Thanks for your post on dockerising rails application. I followed steps in that post but I am using MySql DB and its giving following error bin/rails: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") (Mysql2::Error)
I googled to fix it but nothing worked for me.
My docker command is:
docker run --net=my_isolated_bridge_network --name demo-web --link mysql01
-e DATABASE_HOST=localhost
-e DATABASE_PORT=33060
-e DATABASE_USERNAME=root
-e DATABASE_PASSWORD='YN0N!omijwUpuMytDyPARK0hAz5'
-e DATABASE_SOCKET=/var/run/mysqld/mysqld.sock
-e REDIS_URL=redis://172.17.0.1:6380/1
-p 3000:3000
demo
I tried to use --link option to communicate two container and also putted in same network also. Yes we can do it using docker-compose but is it possible without using docker-compose. Please help. Thanks in advance.
Hi @swzensar8 and sorry for the delayed response. Do you still have the issue?