Home >Operation and Maintenance >Docker >The difference between docker images and containers
The entire life cycle of docker consists of three parts: image, container, and repository.
Let’s take a look at the difference between docker images and containers:
The concept of docker images is similar to the image of a virtual machine. It is a read-only template, an independent file system, including the data required to run the container, which can be used to create new containers.
Docker images are actually composed of layers of system files. This level of file system is called UnionFS (Union file system). The image can be built based on dockerfile, which is a description file, which contains several secret commands. Each command creates a new hierarchical structure for the underlying file system.
Docker uses containers to run applications: docker containers are running instances created by docker images. Docker containers are similar to virtual machines and can be started, stopped, deleted, etc.
Each container is isolated from each other. A specific application will be run in the container, including the code of the specific application and the required dependency files. You can think of a container as a simplified version of the Linux environment (including root user permissions, process space, user space, network space, etc.) and the applications running in it.
For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.
The above is the detailed content of The difference between docker images and containers. For more information, please follow other related articles on the PHP Chinese website!