假设我有一个json文件,我运行cat testTab.json | jq '.action.service.spec.task| select(.container) | .container'它,它给了我
{
"image": "ubuntu:latest",
"args1": "tail",
"args2": "-f",
"args3": "/dev/null",
"mounts": {
"source": "/home/testVolume",
"target": "/opt"
},
"dns_config": null
}
Run Code Online (Sandbox Code Playgroud)
我应该如何编辑此命令来获取所有参数(args1、args2 和 args3)值(“tail”“-f”“/dev/null”)
假设我们有以下堆栈文件:
version: "3"
services:
ubuntu:
image: ubuntu
deploy:
replicas: 2
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: 50M
entrypoint:
- tail
- -f
- /dev/null
logging:
driver: "json-file"
ports:
- "80:80"
networks:
- webnet
web:
image: httpd
ports:
- "8080:8080"
hostname: "apache"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
resources:
limits:
memory: 32M
reservations:
memory: 16M
depends_on:
- "ubuntu"
networks:
- webnet
networks:
webnet:
Run Code Online (Sandbox Code Playgroud)
当我运行时docker service inspect mystack_web,生成的输出不会显示对depends_on条目的任何引用。
这样可以吗?以及如何打印给定docker服务的依赖关系?