Forem

Cover image for Docker: Images Vs Containers
Rakib Hasan
Rakib Hasan

Posted on

13

Docker: Images Vs Containers

In technologies like Docker, Images and Containers are fundamental concepts in containerization. People how are new to this technology often get confused about different between Images and Containers. Hope fully you will learn key difference between them in the blog post.

Images

  1. Definition: An image is lightweight, standalone, and executable package that include everything needed to run a piece of software, including code, runtime, libraries, environment variables, and configuration files.
  2. State: Images are static, Once created, they do not change.
  3. Creation: Images are built from a set of instructions (e.g., a Dockerfile). They are created using the docker build command.
  4. Storage: Images are stored in image registries (e.g., Docker hub, Amazon ECR. Google Container Registry).
  5. Usage: Images serve as the blueprint for a containers. They are used to create containers but cannot be executed directly.

Containers

  1. Definition: A container is a runnable instance of an image. Containers include the application and all its dependencies, running in an isolated environment.
  2. State: Containers are dynamic. They can be started, stopped, moved, and deleted. Their state can change over time as the application runs.
  3. Creation: Containers are created from images using the docker run command.
  4. Storage: Containers are temporary by nature. Their data can be lost if they are not configured to persist (e.g., using volumes for data persistence).
  5. Usage: Containers are the actual instances where applications run. They provide the runtime environment for applications and can be managed (e.g., started, stopped) using Docker commands.

Summary

  • Images are immutable templates that define what the containerized application looks like, including all dependencies and configurations.
  • Containers are the live, running instances of those images, providing the execution environment for applications.

docker-images-vs-containers

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay