Get startedGet started for free

Keeping packages up-to-date

Keeping Docker images up-to-date makes them more secure because applications might have released security updates since the image was released. This means even when using an image from a trusted source, we should update all the software on the image before using it in a production environment.

Exactly how you can update all software on an image depends on the image and its operating system. Let's learn how to update all packages on Ubuntu using the apt-get package.

  • First, start a container from the ubuntu image while setting the correct flag to get an interactive session in the container.
  • In the Ubuntu container, run apt-get update to make the apt-get package manager check if any updates are available for any packages.
  • Run apt-get upgrade to upgrade all installed packages.

Before confirming the upgrade, you'll be able to see the various reasons the package will be changed. What are the reasons?

This exercise is part of the course

Introduction to Docker

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise