Checklist para Despliegues sin Interrupciones con Docker

Guía práctica de despliegue blue-green con Docker en CI/CD: cero downtime, dos entornos, Nginx, healthchecks, pruebas, rollbacks y observabilidad.

19 sept 2025 • 3 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Introducción: Desplegar nuevas versiones sin interrumpir a los usuarios es una expectativa indispensable en servicios modernos. Esta checklist práctica, centrada en Docker, describe un flujo blue green que puedes copiar en tu pipeline CI CD hoy mismo para lograr despliegues sin downtime y minimizar riesgos.

Por qué importa cero interrupciones: confianza de usuario y retención; impacto en ingresos por minutos facturables perdidos; sobrecarga operativa por rollbacks manuales. Mantener dos entornos productivos listos y cambiar el tráfico de forma atómica reduce estos problemas.

Prerequisitos: Docker Engine 20.10 en hosts; Docker Compose o Docker Swarm para orquestación; un reverse proxy como Nginx o HAProxy como punto de entrada; un endpoint de salud /healthz que devuelva 200 cuando el servicio está listo. Si usas Kubernetes, sustituye los comandos Docker por kubectl.

1. Preparar un docker compose con dos servicios idénticos llamados app_blue y app_green. Mantén un placeholder para que tu CI inyecte la etiqueta de imagen. Cada servicio debe exponer puertos internos distintos, por ejemplo 8081 y 8082, y definir un healthcheck que consulte /healthz.

2. Verificar health checks localmente: docker compose up -d y luego curl -s https://localhost:8081/healthz y curl -s https://localhost:8082/healthz. Corrige cualquier fallo antes de avanzar.

3. Configurar Nginx para el cambio de tráfico: usar un bloque upstream que apunte inicialmente a la instancia blue en 127.0.0.1:8081. Cuando quieras cambiar, actualiza el upstream a 8082 y ejecuta nginx -s reload para recargar sin cortar conexiones activas.

4. Desplegar el entorno green: docker compose up -d app_green. Monitoriza sus health checks hasta que estén en verde. Solo entonces consideres migrar tráfico.

5. Realizar el switch atómico de tráfico: editar la configuración de Nginx para que apunte al puerto 8082 y ejecutar sed -i s/8081/8082/ /etc/nginx/conf.d/myapp.conf seguido de nginx -s reload. Nginx recarga sin interrumpir conexiones, ofreciendo una transición suave.

6. Validar el release green con una comprobación externa: curl -s -o /dev/null -w %http_code% https://api.miapp.com/healthz y esperar 200. Si aparecen errores, procede al rollback.

7. Plan de rollback: para revertir inmediatamente, restaura el upstream a 8081 con sed -i s/8082/8081/ /etc/nginx/conf.d/myapp.conf y nginx -s reload. Como los contenedores blue siguen en ejecución, la reversión es instantánea.

8. Retirar el entorno antiguo: cuando el entorno green sea estable, elimina los contenedores blue con docker compose rm -sf app_blue y, si lo deseas, renombra app_green a app_blue para el próximo ciclo de lanzamiento.

9. Logging y observabilidad: exporta métricas con docker stats --no-stream o cAdvisor; centraliza logs en ELK o Loki; configura alertas por fallos de health check o picos de 5xx en Nginx. Una buena observabilidad ayuda a detectar regresiones antes de que afecten a usuarios.

Bonus para migraciones de base de datos: sigue el patrón expand contract. Expand: añade columnas o tablas nuevas y tolerantes; Deploy: lanza código que escriba en campos antiguos y nuevos; Contract: tras un periodo seguro, elimina lo antiguo. Ejecuta migraciones en un job CI separado antes de arrancar los contenedores green.

Recomendaciones prácticas: automatiza la edición de configuración desde tu pipeline CI CD, utiliza nombres de imagen con tag inyectado por el sistema de construcción y mantén pruebas de humo automatizadas y alertas antes y después del switch.

Sobre Q2BSTUDIO: en Q2BSTUDIO somos una empresa de desarrollo de software y aplicaciones a medida especializada en soluciones a medida, inteligencia artificial y ciberseguridad. Ofrecemos servicios integrales que incluyen desarrollo de aplicaciones a medida, integración de servicios cloud aws y azure, servicios de inteligencia de negocio y proyectos de IA para empresas. También realizamos auditorías de seguridad y pentesting para proteger tus sistemas.

Palabras clave integradas: aplicaciones a medida, software a medida, inteligencia artificial, ciberseguridad, servicios cloud aws y azure, servicios inteligencia de negocio, ia para empresas, agentes IA, power bi. Si necesitas ayuda para implementar un flujo de despliegue sin interrupciones, integrar agentes IA o potenciar tu inteligencia de negocio con Power BI, en Q2BSTUDIO podemos acompañarte de principio a fin. Conecta con nuestro equipo de especialistas y acelera tus releases con confianza.

Enlaces útiles: conoce nuestras soluciones de Inteligencia Artificial en servicios de IA para empresas y consulta nuestras ofertas de desarrollo de aplicaciones a medida para empezar un proyecto seguro y escalable.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat