Optimización Avanzada en Docker

1

La importancia de Aprender Docker

2

Desbloqueando el Poder de Docker

3

Construcción de Imágenes Multi-stage

4

Escaneo de imágenes en Docker

5

Optimización de Imágenes de docker con Distroless

6

Compilación Multiplataforma

7

Gestión de Caché y Eficiencia en Builds

8

Reducción de Dependencias y Minimización de Tamaño

9

Optimización de Build Context y Reducción de Transferencias

10

Explorando Docker Hub

Buenas Prácticas en Docker

11

Uso Eficiente de Capas en Imágenes Docker

12

Uso de .dockerignore para Optimización

13

Eliminación de Archivos Temporales y Residuos en Docker

14

Agrega usuarios a tu imagen de docker

15

Mejores Prácticas para Construcción de Imágenes

Instalación y Configuración en Entornos Multiplataforma

16

Despliegue de Docker en Azure y Entornos Locales

17

Publicar tu imagen a Container Apps de Azure

Redes Avanzadas y Balanceo de Carga

18

Modelos de Red en Docker

19

Exposición y Publicación de Puertos en Docker

20

Balanceo de Carga con Docker

Automatización de CI/CD

21

Ejecución de Scripts Multi-line en Docker

22

Automatización de CI/CD con Docker

23

Estrategias Avanzadas de CI/CD en Docker

24

Publicando mi imagen de docker a la nube con CI/CD

Orquestación

25

Retomando Docker Compose

26

Secciones en un archivo Docker Compose

27

Agregando volúmenes con Docker Compose

28

Secuencia de apagado

29

Introducción a Docker Swarm

30

Replicación de Stacks con Docker Compose

31

De Docker a la nube

32

Orquestadores de contenedores

33

Costos de Docker

Develop

34

Introducción a los devcontainers

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:

1 Días
9 Hrs
33 Min
54 Seg

Optimización de Imágenes de docker con Distroless

5/34
Resources

What is the Distroless concept and how does it apply to Docker images?

In the world of software development, optimization and efficiency are vital. This is why the concept of "Distroless" images has gained popularity among developers using Docker. Distroless images are based on the idea of creating Docker images that are as small and compact as possible by removing all unnecessary layers and components. This strategy resembles the concepts of serverless or wireless, where one gets rid of physical components, but still relies on their underlying existence.

By using Distroless images, a minimalist Linux distribution is maintained. It does not focus on having a complete distribution, but on the essentials for applications to be deployed efficiently.

How to work with Distroless images in Docker?

To work effectively with Distroless images in Docker, it is crucial to know certain tools and processes. Here we show you the key steps with clear examples:

  • Google Container Tools repository: you can visit the Distroless repository on Google Container Tools which contains examples of optimized images based on minimal Debian distributions. This repository is a valuable resource for learning and experimenting.

What is the process for creating and using Distroless images?

  1. Preparing the working environment: You must have Docker installed on your machine. You will also need a development environment such as Visual Studio Code to work with the necessary files.

  2. Create directory and files: Inside your project, create a new directory, for example, called distroless, and in this, two crucial files: Dockerfile and a sample Python script like hello.py.

  3. Dockerfile configuration: Make sure your Dockerfile uses a minimalist, optimized base image, and then switch to a Distroless image for the final export of the application.

    Use an optimized base image

    FROM python:3.10-slim AS builder WORKDIR /app COPY hello.py .

    Change to a Distroless image

    FROM gcr.io/distroless/python3 COPY --from=builder /app /app /app CMD ["python3", "/app/hello.py"]

  4. Compilation and execution of the image: In the terminal, run the command to create your Docker image. This will help to check the usage efficiency of Distroless images by seeing the difference in size and speed.

    docker build -t hello-python .

Notice how the resulting image is significantly smaller in size compared to traditional images.

What are the benefits of using Distroless images?

  • Size reduction: By running Distroless images, the size of the images can be drastically reduced. For example, going from an 840 MB image to only 52 MB.

  • Improved security: By eliminating unneeded components, the attack surface is reduced, making applications less vulnerable to exploits.

  • Optimized performance: Applications load and run faster, resulting in more efficient deployment times.

Using Distroless images is not just about removing the Linux distribution, but optimizing it as much as possible, giving you small but fully functional images. Getting into this approach puts you one step ahead in the competitive world of software development, achieving more agile and secure applications. Keep exploring and empowering your skills!

Contributions 6

Questions 0

Sort by:

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

**Distroless** es un enfoque para crear imágenes de contenedores mínimas, sin incluir herramientas o paquetes innecesarios como shells o administradores de paquetes. ### **Principales características:** * **Ligero y seguro:** Reduce el tamaño de las imágenes y minimiza la superficie de ataque al eliminar componentes innecesarios. * **Específico para aplicaciones:** Contiene solo las bibliotecas esenciales para ejecutar una aplicación. * **Optimizado:** Mejora los tiempos de arranque y la eficiencia del contenedor. **Distroless** te permite crear contenedores más seguros y eficientes, enfocados únicamente en ejecutar tu aplicación.
claro por que fue utilizada la version python:3-slim siendo slim la version mas austera es decir la imagen **python:3.10-slim** es una de las versiones más básicas y ligeras del contenedor de Docker para Python. Esta imagen contiene solo los componentes esenciales necesarios para ejecutar Python, lo que reduce significativamente el tamaño de la imagen
Esta parte de Distroless se ve que esta en progreso, pero eso no le quita el gran potencial que tiene. El decremento de tamaño es genial porque cuando tienes tu registry, es muy importante el tamaño así podrías almacenar mas imágenes históricas por cualquier tema. Ademas la velocidad de pull cuando se corren en ambiente productivo es mucho más rápido.
Vayah, Esto <\<Distroless>> Esta R Genial, Que Bien por saber esto @hora. Yo si que habia tenido contacto con Distroless en AWS cuando crecias una Instancia en EC2 y la arrancabas se debia seleccionar la Imagen ISO para el O>S de la Nueva Instancia, estas Imagenes viene con lo minimo posible de la distribucion , ahora para dockerImage la minimilismo sera mucho mayor aun permitiendo crear imagenes muy Ligeras para conteneer todas las dependecias y pequetes necesarios para Software.
¡Espectacular! 🤯
desplegando contenedor de imagen creada: docker run -it --rm --name hellopythoncnt hellopython