如何在 docker-stack 文件中使用 wait-for-it?
How to use wait-for-it in docker-stack file?
这是我想做的。
当 myApp2 启动并且 运行ning 时,我想 运行 myApp1。我正在尝试使用 wait-for-it.sh 但我似乎无法让它工作。 =[请帮忙!
version: '3'
services:
myApp1:
image: myApp1:latest
ports:
- 40400:40400
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
mode: replicated
replicas: 1
depends_on:
- "myApp2"
command: ["./wait-for-it.sh", "myApp2:40000"]
myApp2:
image: myApp2:latest
ports:
- 40000:40000
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/var/run/docker.sock:/var/run/docker.sock
deploy:
mode: replicated
replicas: 1
您没有指定等待 it.sh 返回成功后要做什么。尝试:
command: ["./wait-for-it.sh", "myApp2:40000", "-s", "--", "<your program>", "your program arguments if any"]
这是我想做的。 当 myApp2 启动并且 运行ning 时,我想 运行 myApp1。我正在尝试使用 wait-for-it.sh 但我似乎无法让它工作。 =[请帮忙!
version: '3'
services:
myApp1:
image: myApp1:latest
ports:
- 40400:40400
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
mode: replicated
replicas: 1
depends_on:
- "myApp2"
command: ["./wait-for-it.sh", "myApp2:40000"]
myApp2:
image: myApp2:latest
ports:
- 40000:40000
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/var/run/docker.sock:/var/run/docker.sock
deploy:
mode: replicated
replicas: 1
您没有指定等待 it.sh 返回成功后要做什么。尝试:
command: ["./wait-for-it.sh", "myApp2:40000", "-s", "--", "<your program>", "your program arguments if any"]