How do i choose a smaller docker image for my container?



  • Note: It is best practice to use smaller images if possible. If a smaller image will do the same job as a bigger image, using a smaller image is better.

    Pull the images first.

    $ docker pull alpine
    $ docker pull fedora
    

    Check the image sizes.

    docker images
    REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
    alpine                     latest              3f53bb00af94        2 weeks ago         4.41MB
    fedora                     latest              25e6809f6fab        2 weeks ago         274MB
    

    The image size difference is quite big. Using a smaller image is just for streamlining your applications. There are cases where you have a specific requirement to use a certain image even if it is bigger.

    Delete the image you do not need.

    $ docker rmi fedora
    

Log in to reply
 

© Lightnetics 2024