Here is the picture of what I am doing:
- I have local Go API code, I have built it into a docker image.
- I have pulled MySQL docker image from docker.
- I have DB in MySQL and Go API is accessing mysql.
Everything worked fine till my Go API was local and mysql was docker container. Now I have built local Go code as docker image and when I try to run this image using docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql:5.5
, Docker container starts and exits immediately.
I tried Docker Start -a Container-ID
to start container again, I get this error 'dial tcp 127.0.0.1:3306: getsockopt: connection refused'.
When I searched about this error I got this input - "After setting bind-address: 127.0.0.1 in mysql server config I was able to get the installation working with host localhost:3306."
But I am not aware how to set bind-address.
Any inputs regarding this will be helpful.
Thanks.
127.0.0.1:3306
? – Daniel Müssig