Skip to main content
  1. Posts/
  2. Docker/

·205 words·1 min·
Jaume Sabater
Author
Jaume Sabater
CTO and systems engineer

Image management with Docker
#

Docker images are the foundation of containerization. This section introduces commands to pull, list, and remove images, enabling you to manage the base templates used to create containers.

Start by pulling, i.e., downloading into your local disk, a PostgreSQL image:

docker pull postgres:15

Image tags are used to identify specific versions of an image. For example, postgres:latest refers to the most recent version of the PostgreSQL image, while postgres:15 refers to a specific release. Tags help you manage and deploy precise versions of images, ensuring consistency and reliability across different environments.

Show available local images:

docker images

Now download a different image with a more recent version of PostgreSQL:

docker pull postgres:17

If you run docker images again, you should have (at least) two images available. Optionally, you can now delete the image you do not plan to use, say postgres:15:

docker rmi postgres:15

When you use docker pull, Docker downloads the image in layers. Each layer represents a specific change to the filesystem, such as installing a package or adding an application. This layered approach allows for efficient storage and faster downloads, as only the layers that are missing or updated are transferred, reducing bandwidth usage and improving performance.

Related

·762 words·4 mins

·1504 words·8 mins

·1287 words·7 mins