Answer the question
In order to leave comments, you need to log in
How to manage multiple versions of an application using docker?
The task is to deploy different application branches in docker containers on a remote server.
Each branch has its own number (task number). The application is deployed using docker-compose and consists of 3 services: nginx, php-fpm, mysql. Each branch should be available under its own url (1001.example.com, 1002.example.com, etc.)
For each branch, I want to run my own nginx, php-fpm and mysql containers
The problem is that nginx port 80 can be connected with server port 80 for only one container, but I want for each.
What is the best way to proceed in this case? How to pass requests to the right container?
Answer the question
In order to leave comments, you need to log in
Found a solution to my problem in this article:
Tutorial: Using Docker and Nginx to Host Multiple ...
And how are you even going to distinguish this on the web client side?
If by URL or Header in HTTP, then nginx can handle all this.
Docker Compose is a development tool.
For production, you need to use Docker Swarm or Kubernetes or the like.
They know how. Google "Docker Swarm Blue Green Development"
I think you need to look at swarm.
If you really want to run several copies of nginx on the same host, you will have to refuse port forwarding to the host machine:
ports:
- '80'
- '443'
nginx:
image: nginx:latest
ports:
- '80'
- '443'
networks:
- 1001.example.com
restart: always
networks:
1001.example.com:
driver: bridge
ipam:
driver: default
config:
- subnet: 10.100.0.0/24 #Для каждой ветки своя подсеть.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question