modxcms / docker-modx

Docker image for MODX
https://modx.com
GNU General Public License v2.0
48 stars 38 forks source link

Unable to connect to docker mysql container (usage without link) #10

Closed xgenvn closed 7 years ago

xgenvn commented 7 years ago

Hi, I have another mysql container running on localhost, how can I use that mysql instead of linking new one during building this container? When I assign enough ENV variables, modx container can be started, but then I cannot connect to the mysql server (maybe there're some issues with net address resolving?). I'm trying to use Kitematic to create and manage containers.

Thank you.

vh commented 7 years ago

Hi, correct way is to run mysql in docker container and then link it with modx container. But if you want to share localhost with your containers you must run a container with network settings set to host (--net="host" key). Then you have to add to container's /etc/hosts localhost alias - 127.0.0.1 mysql.

xgenvn commented 7 years ago

So the best way is to create a Docker compose and start with that instead of using Kitematic, right?

vh commented 7 years ago

I've never used Kitematic, think it is possible to link containers also. But as for me the simplest way to use Docker compose.

xgenvn commented 7 years ago

Currently there's no option for Kitematic to take advantage of docker-compose. So I think I'll use docker compose then.

Thank you.