如何从docker compose文件中查看容器的容器运行状况
因为docker编写了1.10.0。我开始在我的docker compose文件中实现这些 有几个站点建议从如何从docker compose文件中查看容器的容器运行状况,docker,docker-compose,go-templates,Docker,Docker Compose,Go Templates,因为docker编写了1.10.0。我开始在我的docker compose文件中实现这些 有几个站点建议从docker ps查看容器的运行状况。见下文 但是,在运行docker ps时,我看不到任何运行状况。我的docker compose文件的摘录如下所示: version: "2.1" services: my-service: container_name: my-service image: "our-registry:5000/my-service:1.0.1
docker ps
查看容器的运行状况。见下文
但是,在运行docker ps
时,我看不到任何运行状况。我的docker compose文件的摘录如下所示:
version: "2.1"
services:
my-service:
container_name: my-service
image: "our-registry:5000/my-service:1.0.1"
expose: [3000]
restart: always
depends_on:
- other-service-1
- other-service-2
healthcheck:
test: ["nc", "-z", "127.0.0.1", "3000", "||", "exit", "1"]
interval: "2s"
timeout: "1
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
af680b9fc6c3 our-registry/pr-georegion:1.0.1 "node index.js" 8 minutes ago Up 8 minutes 3000/tcp pr-georegion
我的docker ps
输出摘录如下:
version: "2.1"
services:
my-service:
container_name: my-service
image: "our-registry:5000/my-service:1.0.1"
expose: [3000]
restart: always
depends_on:
- other-service-1
- other-service-2
healthcheck:
test: ["nc", "-z", "127.0.0.1", "3000", "||", "exit", "1"]
interval: "2s"
timeout: "1
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
af680b9fc6c3 our-registry/pr-georegion:1.0.1 "node index.js" 8 minutes ago Up 8 minutes 3000/tcp pr-georegion
Docker和Docker组合版本:
# docker -v
Docker version 1.12.6, build 78d1802
# docker-compose -v
docker-compose version 1.10.1, build b252738
我在docker compose文件中发现了问题。来自[官方文档](测试必须是字符串或列表。如果是列表,则第一项必须是NONE、CMD或CMD-SHELL。如果是字符串,则相当于在该字符串后面指定CMD-SHELL。): 测试必须是字符串或列表。如果是列表,则第一项必须是NONE、CMD或CMD-SHELL。如果是字符串,则相当于在该字符串后面指定CMD-SHELL 所以我改变了:
test: ["nc", "-z", "127.0.0.1", "3000", "||", "exit", "1"]
用于:
我在docker compose文件中发现了问题。来自[官方文档](测试必须是字符串或列表。如果是列表,则第一项必须是NONE、CMD或CMD-SHELL。如果是字符串,则相当于在该字符串后面指定CMD-SHELL。): 测试必须是字符串或列表。如果是列表,则第一项必须是NONE、CMD或CMD-SHELL。如果是字符串,则相当于在该字符串后面指定CMD-SHELL 所以我改变了:
test: ["nc", "-z", "127.0.0.1", "3000", "||", "exit", "1"]
用于: