Every time a small app developed by myself restarts Docker, there may be a bug in the code or the service may restart, which will cause problems for the users who are using it. So deploy two Docker container runs so that when one dies or restarts, you can switch to the other service. Also learn about nGINx load balancing.

Upstream {server 127.0.0.1:203; 127.0.0.1:205; # container 2 ip_hash; } server { listen 443 ssl http2; server_name xxx.xxx.com; ssl_certificate /etc/nginx/cert/xxx.xxx.com.pem; ssl_certificate_key /etc/nginx/cert/xxx.xxx.com.key; # service location ^~ / API/XXX / {proxy_pass http://myNginx; }}Copy the code