What is the difference between ‘docker run’ and ‘docker create’?
What is the difference between ‘docker run’ and ‘docker create’?
The difference between docker run
and docker create
lies in their functionality and the stages of the container lifecycle they address.
docker create
docker create
command is used to create a new container from a specified image without starting it.docker create
, Docker performs the following actions:
docker create --name mycontainer ubuntu
docker run
docker run
command is used to create and start a new container from a specified image in one step.docker run
, Docker performs the following actions:
docker create
).docker run --name mycontainer ubuntu
docker create
only creates the container, while docker run
creates and starts the container.docker run
immediately executes the container's main process, whereas docker create
does not start the container automatically.docker run
, you can specify commands and arguments to be executed when the container starts. With docker create
, you need to use docker start
to run the container after creation.docker create --name mycontainer ubuntu
junior
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào