Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Desplegando un Zoológico de Contenedores con Docker

Tiempo de lectura: 2 minutos

¡Bienvenido al emocionante mundo de Docker, donde desplegaremos un zoológico completo de contenedores en solo unos pasos! 🎉🐳🚀

Paso 1: Instalación de Docker

Si aún no tienes Docker instalado, dirígete al sitio oficial de Docker y sigue las instrucciones para tu sistema operativo.

Paso 2: Preparando el Terreno

Crea una nueva carpeta llamada «ZooContainers» en tu escritorio y navega hasta ella en tu terminal.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
mkdir ~/Desktop/ZooContainers
cd ~/Desktop/ZooContainers
mkdir ~/Desktop/ZooContainers cd ~/Desktop/ZooContainers
mkdir ~/Desktop/ZooContainers
cd ~/Desktop/ZooContainers

Paso 3: Creando el Dockerfile del Elefante 🐘

Dentro de la carpeta, crea un archivo llamado Dockerfile.elephant y añade el siguiente contenido:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
FROM ubuntu:latest
RUN apt-get update && apt-get install -y elephants
FROM ubuntu:latest RUN apt-get update && apt-get install -y elephants
FROM ubuntu:latest

RUN apt-get update && apt-get install -y elephants

Este Dockerfile instala el paquete de elefantes en una imagen de Ubuntu.

Paso 4: Construyendo la Imagen del Elefante

En tu terminal, ejecuta el siguiente comando para construir la imagen del elefante:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
docker build -t zoo/elephant -f Dockerfile.elephant .
docker build -t zoo/elephant -f Dockerfile.elephant .
docker build -t zoo/elephant -f Dockerfile.elephant .

Paso 5: Creando el Dockerfile del León 🦁

Ahora, crea otro archivo llamado Dockerfile.lion con el siguiente contenido:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
FROM ubuntu:latest
RUN apt-get update && apt-get install -y lions
FROM ubuntu:latest RUN apt-get update && apt-get install -y lions
FROM ubuntu:latest

RUN apt-get update && apt-get install -y lions

Este Dockerfile instala el paquete de leones en una imagen de Ubuntu.

Paso 6: Construyendo la Imagen del León

Ejecuta el siguiente comando para construir la imagen del león:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
docker build -t zoo/lion -f Dockerfile.lion .
docker build -t zoo/lion -f Dockerfile.lion .
docker build -t zoo/lion -f Dockerfile.lion .

Paso 7: ¡Desplegando el Zoológico!

Es hora de desplegar nuestro zoológico de contenedores. Ejecuta los siguientes comandos:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
docker run -d --name elephant-container zoo/elephant
docker run -d --name lion-container zoo/lion
docker run -d --name elephant-container zoo/elephant docker run -d --name lion-container zoo/lion
docker run -d --name elephant-container zoo/elephant
docker run -d --name lion-container zoo/lion

¡Y listo! Ahora tienes un zoológico de contenedores con un elefante y un león.

Paso 8: Visitando el Zoológico

Para ver a tus animales en acción, abre tu navegador y visita:

¡Disfruta de tu zoológico de contenedores con Docker! 🚀🐳

PD: Este tutorial es un concepto gracioso con el que practicar Docker.

0

Deja un comentario