It says:
This image provides the standard MySQL port (3306), so container binding makes the MySQL instance available to other application containers.
First, make sure your docker starts the card, that port: -p 3306:3306 (or the open port from the Docker file will not be accessible from the Linux host)
Then you need
After the discussion, it turned out that adding a port mapping to the end is wrong:
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest -p 3306:3306
This does not work because "-p 3306: 3306" is simply interpreted as arguments to go to the ENTRYPOINT command.
This works (which means the docker ps -a shows the container how it "works" and not "exits"):
docker run -p 3306:3306 --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
Then root@127.0.0.1 :3306 or root@ $(docker-machine ip):3306 should be correct.
source share