Personally, I'm starting to use Docker, but I still have a lot of questions and one of them is how to point a domain to a specific container.
Firstly I created a Container with a php and apache image in the version I needed and made the link with two other containers
docker run -i -t -p 8080:80 --name apache-php --link postgresdb:postgresdb --link mysqldb:mysqldb -v /home/volumes/html:/var/www/html php:5.6-apache /bin/bash
As I use Linode hosting, I followed this tutorial to set up my domain in the container's apache and it worked as expected until then.
"Name-based Virtual Hosts": link
But obviously it is necessary to do some more configuration, because if I access my domain by setting the port I can see the page (example.com:8080), but if I do not put the port, the page does not open (example.com )
I read a lot of tutorials, doubts and etc and I came to the conclusion that I would need to configure a proxy in apache for this, so I came up with the following configuration file:
example.com.conf:
# domain: example.com
# public: /var/www/html/example.com/public_html/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName example.com
ServerAlias example.com www.example.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/example.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/html/example.com/log/error.log
CustomLog /var/www/html/example.com/log/access.log combined
ProxyRequests On
ProxyVia On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://www.example.com:8080
</VirtualHost>
But it still does not work, so neither does the domain with the port work.
The question is, can anyone help me finally solve this problem? rs