Home > Article > Operation and Maintenance > What are docker images and containers
Docker images are read-only file system templates that contain what the application needs to run. Docker containers are independent environments that run on a given image, are mutable, and can be managed and destroyed. Containers share the image file system but have independent running environments. Docker images and containers improve portability, isolation, scalability and efficiency.
Docker images and containers
What is a Docker image?
A Docker image is a read-only file system template that contains all the code, libraries, and dependencies needed to run an application. Images are immutable, which means that once created, they cannot be modified.
What is a Docker container?
A Docker container is an isolated environment running on a given image. It contains a process that runs the application in the image, as well as any other resources required by the process, such as network, storage, and memory. Containers are mutable, which means they can be created, started, stopped, and destroyed without affecting the underlying image.
The relationship between images and containers
Docker containers are created from Docker images. One image can create multiple containers. Containers share the file system of the underlying image, but they have independent running environments.
Example
Suppose you have a Docker image that contains a web application. You can create multiple containers from this image, each running an independent instance of the application. These containers can be deployed on different servers and updated and managed independently.
Advantages
Using Docker images and containers has the following advantages:
The above is the detailed content of What are docker images and containers. For more information, please follow other related articles on the PHP Chinese website!