You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
3 Hrs
52 Min
47 Seg

Reto ECR/ECS/EKS

25/33
Resources

What is Docker and why is it important in software development?

Docker is a tool that has revolutionized the world of software development by making it easy to create, deploy and run containerized applications. This approach allows applications to run consistently in any environment, which solves the typical "runs on my machine" problem. By encapsulating an application and all its dependencies in a container, Docker ensures that it can run without modification on any machine that has Docker installed.

How to get started with creating a Dockerfile?

Creating a Dockerfile is the first step in containerizing your application. A Dockerfile is a text file that contains the commands needed to assemble a Docker image. Here's a basic flow to get you started:

  1. Define the base image: select a base image that suits your application's needs. For example, if you are working with Node.js, you could use node:14 as your base image.

  2. Copy the source code: Include your application files to the container using COPY or ADD.

  3. Install dependencies: If your application needs external libraries, make sure to install them, usually using a package management system such as npm for Node.js or pip for Python.

  4. Specify the run command: Define which command your application will launch when running in the container. Usually, this is done with the CMD or ENTRYPOINT command.

Here is a basic example:

# Use the base image Node.jsFROM node:14
 # Create the application directoryWORKDIR /usr/src/app
 # Copy necessary filesCOPY package*.json ./
 # Install dependenciesRUN npm install
 # Copy the source codeCOPY. .
 # Expose the port on which the application runsEXPOSE 8080
 # Application execution commandCMD ["node", "app.js"]

How to publish and run your container on a register?

Once you have created your Docker container, the next step is to upload it to a registry to easily manage it and share it with others. The steps are as follows:

  1. Create an account in a Docker Registry: The most common registries are Docker Hub or a private registry.

  2. Tag your image: Use docker tag <image_name> <repository>/<image>:<tag> to tag your image.

  3. Login: Use docker login to enter your credentials and connect to your registry.

  4. Upload image: With the command docker push <repository>/<image>:<tag> you send your image to the registry.

  5. Run the image from the registry: On any Docker machine, you can pull the image using docker pull <repository>/<image>:<tag>. Once downloaded, you can run it with docker run.

What are the benefits of running applications with Docker?

Docker offers a number of significant advantages:

  • Enhanced portability: Containers can be deployed on any machine that has Docker installed, regardless of the underlying operating system.

  • Efficient use of resources: Containers share the operating system kernel, making them very lightweight and easy to manage.

  • Easy continuous integration and deployment (CI/CD): Docker integrates well with CI/CD tools, making it easy to automate testing and deployment.

  • Isolation: Ensures that an application in a container does not affect other applications on the same host.

Getting started with Docker can be a bit daunting at first, but with practice, it will become an essential tool in your developer kit - feel free to experiment and keep practicing!

Contributions 8

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

Te quedaste corto en este curso cuando empezaste con eks… con muchas expectativas de que platzi renueve sus cursos de aws ya es hora!

¿Cuál es la mejor forma de borrar imágenes antiguas en el repositorio?

¿Cómo me aseguro que la tarea que tengo corriendo está usando la última definición de tarea?

¿Cuál es el proceso para migrar de una infraestructura que corre en ECS pero sobre máaquinas ec2 a una que utilice Fargate?

La verdad, no entendí muy bien las 3 últimas clases. Tuve que ver otros videos aparte y leer más la documentación para entender lo que estaban haciendo. Espero que lo puedan renovar, ya van casi 3 años desde que algunos estudiantes sugirieron que renovaran el curso y no lo hicieron. Soy un apasionado del mundo de AWS y la verdad, esta parte fue algo desilusionante.

done

Done.

Hecho