skip to Main Content

I am new to kubernetes and Dockers and microservices. I created several nodejs microservices, and use skaffold to build, run and update my deployments. Everything is working so far. However, when I run docker images, I realised that I have many instances of the same image. Why is that so?

  1. Will this take up more space in my disk drive?
  2. am I doing something wrong?

Screen shot of my images

I just realised that whenenver I make changes to my NextJS client application, skaffold will create new images. Why is that so?

2

Answers


    1. Will this take up more space in my disk drive?

    Images are unique

    This is reflected by the Image ID

    Images uses Tags, an image will be the same if they have same Image ID, they can have different Tags

    No more space will be used for images with different tags and same Image ID

    You can clean them up if you’re not using them with docker image prune command

    am I doing something wrong?

    I just realised that whenenver I make changes to my NextJS client
    application, skaffold will create new images. Why is that so?

    I can’t say if it’s wrong, but definitely it depends on what you want to achieve

    Skaffold is just creating a new image with the newest changes and building an updated image, so if this is what you want then it’s correct – just need to make sure and create a task to clean-up things that you’re not using to save disk space

    I hope this answers your question

    Login or Signup to reply.
    1. Will this take up more space in my disk drive?

    The docker images output and their disk space usage may be a little bit misleading for you. Bear in mind that each Image ID is unique, but an Image ID can have several tags. So the actual amount of disk space used is only related to the number of unique Image IDs you see. The best way to see how much disk space is being used is by issuing docker system df, which will show you the disk space used by images and containers.

    1. am I doing something wrong?

    Not necessarily. It is natural to have several images if you are building repeatedly. Bear in mind that a new image is generated every time you make a change to your Dockerfile, because it needs to create new layers for the changed line, and every line after it (so if you change the Dockerfile frequently, one strategy is to arrange your RUN, COPY, etc. commands so that you minimize the number of newly-created layers). Once you’re done building and you wish to discard the old versions, you can issue docker image prune (which deletes dangling images) or docker system prune (which gets rid of any unused build cache objects).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search