Home > Operation and Maintenance > Docker > What is the difference between run and start in docker

What is the difference between run and start in docker

WBOY
Release: 2022-01-28 11:55:59
Original
8693 people have browsed it

The difference between run and start in docker: the run command is only used when running the image operation for the first time, which is equivalent to performing a two-step operation, putting the image into the container and then starting the container; while the start command is used when Used when restarting an existing image. To use this command, you need to know the container's ID or name.

What is the difference between run and start in docker

The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.

What is the difference between run and start in docker

docker run is equivalent to performing a two-step operation: putting the image into the container (docker create), and then starting the container to make it into a runtime container (docker start).

The function of docker start is to restart the existing image. That is to say, if we use this command, we must know the ID of the container or the name of the container in advance. We can use docker ps to find the information of the container.

What is the difference between run and start in docker

Because the ID of the container is a random code, and the name of the container is a seemingly meaningless name, we can use the command

docker rename  old_name new_name
Copy after login

to give this container name. In this way, when we start or stop the container again, we can use this name directly.

docker [stop] [start]  new_name
Copy after login

To display all containers, including those that have not been started, you can use the command

docker ps -a
Copy after login

Recommended learning: "docker video tutorial"

The above is the detailed content of What is the difference between run and start in docker. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template