user4725754
user4725754

Reputation:

Access to Docker container

I have a LAMP with a lot of added domain names, so many different websites are stored on it. I would like to separate them into Docker containers. Every websites/webapps and all related stuffs should be in a container. File access is solved with --volumes-from flag, but what about MySQL databases and VirtualHosts? How should I set them in a per container way?

Upvotes: 0

Views: 83

Answers (3)

Yogesh Jilhawar
Yogesh Jilhawar

Reputation: 6293

You can expose the MySQL port in dockerfile by using ÈXPOSE` command and then bind your service to divert MySQL related queries on that port.

Upvotes: 0

ipinak
ipinak

Reputation: 6039

You can use the already available MySQL image to start your DB and then connect it either through linking (--link option when running your app), you can find more info in the link.

For you virtualhosts you can use nginx as a proxy and it will route to your apps depending on your criteria (e.g. /admin will be routed to app1-192.197.0.12).

Upvotes: 0

netbrain
netbrain

Reputation: 9304

For MYSQL you could launch one for each container and then link them together using the --link flag. Or you could simply install mysql as server within the docker container itself.

You could also probalby use docker-compose to orchestrate each as a whole.

As for virtual hosts, the following would probably meet your demands?

https://github.com/jwilder/nginx-proxy

Upvotes: 1

Related Questions