Multi-web-service in one server
TL;DR
This uses the naming of networks
in docker-compose
(3.6+) cross different docker-compose.yml
to let Nginx container can access different web server container.
Requirements
Hold multiple web services in single server machine.
Web services are containerized
Gitlab CI/CD are involved for deployment
Tools needed
Docker - containerize the webserver folders.
Docker-compose 3.6+
Details
Nginx container is used for web server. May use Apache for same job with some config modification.
/usr/local/nginx/docker-compose.yml
/usr/local/nginx/conf.d/webserver-1.conf
/usr/local/webserver-1/docker-compose.yml
Remarks
network
name must be the same to share the same networkNginx DNS must be proper set, either make the DNS resolution dynamic(this case), or make container's IP be fixed, otherwise webserver cannot be accessed when webserver container in restarted
hostname in Nginx should be equal to service name (not container name) in
docker-compose.yml
Last updated