Docker 撰写 - 堆栈
Docker compose - stack
我有一个 docker-compose.yml
文件,它显示了 5 个不同的容器。为了实际调出它们,我使用了 docker-composer up -d
。
我喜欢某种 GUI,所以我使用 Portainer 查看我的容器,我注意到 Portainer 容器列表实际上还有一个我在 [=13] 中从未见过的字段=],也就是 stack
.
现在我已经在 Docker documentation 中阅读了有关堆栈的内容,但仍然不太了解一件事。我的 Dockerfile
和 docker-compose.yml
没有提到堆栈,但是当我打开我的容器时,它们都被标记为堆栈,这是我的 Docker 配置所在的文件夹。
除了分类那组容器属于同一个堆栈之外,它还有什么用?可以操纵 属性 以便我为其指定个人命名吗?
编辑:
这是 Portainer 的命名约定。他们在 Docker Swarm 和 Docker Compose [=25] 中使用术语 stack
=].
原文post:
Docker Compose 和 Docker Stack 都可以由 docker-compose.yml
[ 控制=27=]
来自 Nick Janetakis 的 Docker Compose vs Docker Stack:
Docker Compose is an official tool that helps you manage your Docker containers by letting you define everything through a docker-compose.yml
file.
docker stack
is a command that's embedded into the Docker CLI. It lets you manage a cluster of Docker containers through Docker Swarm.
It just so happens both Docker Compose and the docker stack
command support the same docker-compose.yml
file with slightly different features.
In some cases, certain features that only work with docker stack
are ignored by Docker Compose, and likewise, unsupported features of Docker Compose are ignored by the docker stack
command.
For example, the deploy
property is ignored by Docker Compose and depends_on
is ignored by docker stack
. There are other differences too. You can find them out by checking out the official Compose file reference. It will call out Compose or Stack specific properties.
This allows you to define a single docker-compose.yml
that works for both Docker Compose and docker stack
which is a nice quality of life improvement if you happen to use Docker Compose in development and Docker Swarm in production.
我有一个 docker-compose.yml
文件,它显示了 5 个不同的容器。为了实际调出它们,我使用了 docker-composer up -d
。
我喜欢某种 GUI,所以我使用 Portainer 查看我的容器,我注意到 Portainer 容器列表实际上还有一个我在 [=13] 中从未见过的字段=],也就是 stack
.
现在我已经在 Docker documentation 中阅读了有关堆栈的内容,但仍然不太了解一件事。我的 Dockerfile
和 docker-compose.yml
没有提到堆栈,但是当我打开我的容器时,它们都被标记为堆栈,这是我的 Docker 配置所在的文件夹。
除了分类那组容器属于同一个堆栈之外,它还有什么用?可以操纵 属性 以便我为其指定个人命名吗?
编辑:
这是 Portainer 的命名约定。他们在 Docker Swarm 和 Docker Compose [=25] 中使用术语 stack
=].
原文post:
Docker Compose 和 Docker Stack 都可以由 docker-compose.yml
[ 控制=27=]
来自 Nick Janetakis 的 Docker Compose vs Docker Stack:
Docker Compose is an official tool that helps you manage your Docker containers by letting you define everything through a
docker-compose.yml
file.
docker stack
is a command that's embedded into the Docker CLI. It lets you manage a cluster of Docker containers through Docker Swarm.
It just so happens both Docker Compose and the
docker stack
command support the samedocker-compose.yml
file with slightly different features.In some cases, certain features that only work with
docker stack
are ignored by Docker Compose, and likewise, unsupported features of Docker Compose are ignored by thedocker stack
command.For example, the
deploy
property is ignored by Docker Compose anddepends_on
is ignored bydocker stack
. There are other differences too. You can find them out by checking out the official Compose file reference. It will call out Compose or Stack specific properties.This allows you to define a single
docker-compose.yml
that works for both Docker Compose anddocker stack
which is a nice quality of life improvement if you happen to use Docker Compose in development and Docker Swarm in production.