我有以下的docker-compose.yml摘录:
version: "3.9"
services:
elastic:
image: elasticsearch:8.2.3
container_name: elastic
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms1g -Xmx1g
- xpack.security.enabled=false
volumes:
- es_data:/usr/share/elasticsearch/data
ports:
- target: 9200
published: 9200
healthcheck:
test: curl -s http://elastic:9200 >/dev/null || exit 1
interval: 5s
timeout: 5s
retries: 10
networks:
- elastic
app:
build: .
working_dir: /code/app
command: uvicorn main:app --host 0.0.0.0 --reload
env_file: .env
volumes:
- ./app:/code/app
ports:
- target: 8000
published: 8000
restart: on-failure
depends_on:
elastic:
condition: service_healthy
healthcheck:
test: curl -s http://app:8000/nexus/health >/dev/null || exit 1
interval: 5s
timeout: 5s
retries: 10
networks:
- elastic在运行docker compose up -d时,我希望此命令仅在满足app健康检查条件时退出。
我已经在文档中找到了一个--wait命令,但是当我尝试运行这个命令时,它似乎无法工作。另外,我只想再次检查健康检查测试本身是否有效,我不确定是否应该在路径中使用服务名称或本地主机。
发布于 2022-08-25 13:17:59
问题似乎是我使用了以下命令:
docker-compose up --wait问题是,这调用了一个较旧的组合API,它应该是:
docker compose up --waithttps://stackoverflow.com/questions/73470693
复制相似问题