运行和启动Docker容器的区别
问题描述:
在实践中开始一个容器我做:
docker运行a8asd8f9asdf0
In practice to start a container I do: docker run a8asd8f9asdf0
如果是这样的话, b $ bdocker startdo?
If thats the case, what does: "docker start" do?
在手册中,它说
启动一个或多个停止的容器
困惑。
答
-
运行
运行图像 -
开始
启动一个容器 -
run
runs an image -
start
starts a container.
docker run
doc 提到:
The docker run
doc does mention:
docker run
命令首先在指定的映像上创建一个可写容器层,然后使用指定的命令启动它。
The
docker run
command first creates a writeable container layer over the specified image, and then starts it using the specified command.
就是说,docker运行相当于API / containers / create
then / container /(id)/ start
。
That is, docker run is equivalent to the API /containers/create
then /containers/(id)/start
.