CiscoCisco
300-910 · Question #66
300-910 Question #66: Real Exam Question with Answer & Explanation
Sign in or unlock 300-910 to reveal the answer and full explanation for question #66. The question stem and answer options stay visible for context.
CI/CD Pipelines
Question
Refer to the exhibit. A docker-compose.yml file implements a postgres database container. Which .gitlab-ci.yml code block checks the health status of the container and stops the pipeline if the container is unhealthy?
Options
- AValidate Application Infrastructure: stage: Validate_Infrastructure before_script: - apk add --no-cache docker-compose script: - docker-compose up - sleep 15s - health_state = $(docker container logs postgres_data | grep healthcheck) - health_state == 'healthy'
- BValidate Application Infrastructure: stage: Validate_Infrastructure before_script: - apk add --no-cache docker-compose script: - docker-compose up - sleep 15s - health_state = $(docker container attach postgres_data \ | psql -U username postgres status) - health_state == 'running'
- CValidate Application Infrastructure: stage: Validate_Infrastructure before_script: - apk add --no-cache docker-compose script: - docker-compose up -d - sleep 15s - health_state=$(docker container inspect postgres_data --format='{{.State.Health.Status}}') - If [[ "$health_state" != "healthy" ]]; then exit 1; fi
- DValidate Application Infrastructure: stage: Validate_Infrastructure before_script: - apk add --no-cache docker-compose script: - docker-compose up - sleep 15s - health_state = $(docker container state postgres | grep "Health_status" | grep "running") - If [[ "$health_state" == "running" ]]; then exit 1; fi
Unlock 300-910 to see the answer
You've previewed enough free 300-910 questions. Unlock 300-910 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Docker Compose#Container Health Check#GitLab CI/CD#Shell Scripting