I
I
Ilya2016-03-16 20:27:59
MySQL
Ilya, 2016-03-16 20:27:59

Why can't I access mysql docker container?

There is a problem with connecting to a running docker container with mysql from the host machine. That is, if you enter the container itself and use mysql inside, then everything is OK, it works. Problem with connecting from a computer (host) via datagrip. No matter what I tried, it doesn't work. Ports are open, mapped. I'm on mac. Who can tell what is the problem?
DOCKERFILE:

FROM alpine:latest

WORKDIR /app
#VOLUME /app
COPY startup.sh /startup.sh

COPY backup.sql /app/

RUN apk add --update mysql mysql-client && rm -f /var/cache/apk/*
COPY my.cnf /etc/mysql/my.cnf

EXPOSE 3306

Next, I build the image and run the container with the command:
docker run -t -i -d -p 3306:3306 --name mysql mysql

docker ps gives:
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                             NAMES
5fb9d4b9fa99        mysql               "/startup.sh"       7 seconds ago       Up 6 seconds        0.0.0.0:3306->3306/tcp   mysql

In Kitematic access url is this:
192.168.99.100:3306
Next, go to DataGrip, enter the connection parameters:
хост - 192.168.99.100
порт - 3306
юзр - root
пароль - pass

And it won't connect!
What can I do wrong and what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2016-03-16
@dimonchik2013

stackoverflow.com/questions/32360687/connect-to-do...
https://github.com/docker-library/mysql/issues/95
see here and there towards docker-compose

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question