I am following the Docker tutorial and do it in my own version
version: "3.1"
services:
web:
image: registry.gitlab.com/xxxx/xxxx:latest
deploy:
replicas: 2
ports:
- "8888:80"
mysql:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: user
MYSQL_PASS: password
ports:
- "8889:3306"
volumes:
- mysql-data:/var/lib/mysql
volumes:
mysql-data:
Whenever I change some code, I rebuild new docker image and run update.
docker stack deploy --compose-file docker-compose.yml xxxx-learn
Then I noticed some downtime. They will start new container one at the time and stop old container one at the time. Then problem is that it takes a few minutes to download new image and it takes time for web server to run.
One solution that I was thinking of is to run Nginx load balancing in front of those two web server replicas. But is there any better solution?