← Cloud computing

Virtual machines and containers

Containers

容器

A container packages a program with everything it needs to run, so it behaves the same on any machine.

Containers are lighter than virtual machines because they share the same operating system, and they are built from an image that holds the files and settings.

The main difference: a virtual machine carries a full operating system, while a container shares the host's kernel and carries only the app and its libraries, so it starts in seconds and uses fewer resources.

Containers solve the "it only works on my machine" problem: the app inside a container runs the same way on the developer's computer, the test server and the production server.

When there are many containers, orchestration tools such as Kubernetes run them, spread them across servers and automatically restart any that fail.

Ask the AI assistant

Ask anything about this lesson and get a simple answer with the terms in Chinese, Arabic and English.

The AI assistant runs on Google's Gemini model and can make mistakes. Do not write personal information. Available to signed-in learners, up to 30 requests a day.

The content is simplified and covers the basics only.