Challenge - 5 Problems
Docker Compose Pipeline Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediateOutput of Docker Compose Up in Jenkins Pipeline
What will be the output of the following Jenkins pipeline snippet when it runs the Docker Compose up command?
Jenkins
pipeline {
agent any
stages {
stage('Start Services') {
steps {
script {
sh 'docker-compose up -d'
}
}
}
}
}Attempts:
2 left
💡 Hint
Think about what the '-d' flag does in docker-compose up command.
✗ Incorrect
The '-d' flag runs containers in detached mode, so the command starts services and prints container IDs without blocking the pipeline.
❓ Configuration
intermediateCorrect Jenkinsfile Syntax for Docker Compose
Which Jenkinsfile snippet correctly runs 'docker-compose down' to stop and remove containers in a pipeline stage?
Attempts:
2 left
💡 Hint
Check the correct way to pass shell commands as strings in Jenkins pipeline.
✗ Incorrect
The command must be passed as a quoted string to the sh step. Option D uses single quotes correctly.
❓ Troubleshoot
advancedTroubleshooting Docker Compose Service Not Starting
In a Jenkins pipeline, the 'docker-compose up' command runs but the service fails to start. Which is the most likely cause?
Attempts:
2 left
💡 Hint
Think about what is required for docker-compose commands to work on the Jenkins agent.
✗ Incorrect
Docker and Docker Compose must be installed and the Docker daemon running on the Jenkins agent to start services.
🔀 Workflow
advancedBest Practice for Using Docker Compose in Jenkins Pipeline
Which workflow step is best to ensure Docker Compose services are cleaned up after tests in a Jenkins pipeline?
Attempts:
2 left
💡 Hint
Consider how to properly remove containers and networks after pipeline completion.
✗ Incorrect
'docker-compose down' stops and removes containers, networks, and volumes, cleaning up resources after tests.
🧠 Conceptual
expertUnderstanding Docker Compose Exit Codes in Jenkins
If a service in 'docker-compose up' fails to start, what exit code does the command return, and how should Jenkins handle it?
Attempts:
2 left
💡 Hint
Think about how shell commands signal failure and Jenkins pipeline behavior.
✗ Incorrect
Docker Compose returns a non-zero exit code if any service fails to start, causing Jenkins to fail the pipeline unless handled.
