I'm new to Docker and might be confusing things but let's say I have multiple projects and I want to use the same docker MySQL database with them.
Some of these projects also run Docker, some do not, the ones running Docker have docker-compose.yml in repos so I cannot change this file, for the others I don't want to use Docker at all (excepting the base container).
I pulled https://hub.docker.com/_/mysql/ already then run it like this:
docker run --name mysql-experiment -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7.21
When I run docker ps
I can see mysql-experiment
is running.
I'm able to login to the container using docker exec -it mysql-experiment bash
. But I'm not good enough with MySQL to manage it through Terminal.
My question is - how could I setup this container so it gets its own port, and IP and I can use it anywhere within my local network, without docker-compose?
Right now it runs on localhost on port 3306
(according to docker ps
), but when I try to access 127.0.0.1:3306 in Sequel Pro I'm getting:
Unable to connect to host 127.0.0.1, or the request timed out.
Also, I'm not sure what username I should use with this container (I've tried admin/root/empty)
[edit]
I know there are many questions like this one, but all of them involve docker-compose.