Docker Assignment– 5
Docker in CI/CD & DevOps
Basic Questions
- Install Docker on a Jenkins server and verify it is available to pipelines.
- Install Docker on a GitLab Runner and verify it is available to jobs.
- Write a simple Jenkins pipeline that prints docker –version.
- Write a GitLab CI job that prints docker ps -a.
- Create a Dockerfile for a simple Node.js app.
- Build the image locally using docker build -t myapp:v1 ..
- Push the image to Docker Hub manually.
- Write a Jenkins pipeline stage that builds the myapp:v1 image.
- Write a GitLab CI job that builds the myapp:v1 image.
- Write a GitHub Actions workflow job that builds the myapp:v1 image.
- Add a pipeline step that pushes the built image to Docker Hub.
- Use a .env file in the pipeline to pass Docker Hub credentials.
- Tag an image with both latest and v1 inside a pipeline.
- Add a step to remove dangling images in a pipeline (docker image prune -f).
- Automate running a container after building the image inside a pipeline.
- Write a Jenkins pipeline that echoes “Build Completed” after Docker build.
- Use docker login inside a pipeline with stored credentials.
- Set up a multistage Dockerfile and build it in a pipeline.
- Inspect the layers of the built image in a pipeline step.
- Document Docker best practices: small base image, caching, .dockerignore.
Intermediate Questions
- Write a Jenkins pipeline with stages: Checkout → Build Docker Image → Push to Registry.
- Write a GitLab CI/CD pipeline that builds a Docker image on merge requests.
- Configure GitHub Actions to build a Docker image when code is pushed to main.
- Write a Jenkins pipeline that runs tests inside a container after building.
- Write a GitLab CI job that deploys the container after building.
- Configure a Jenkins pipeline to build different image tags based on branch name.
- Write a GitLab CI job that pushes Docker images to a private GitLab Container Registry.
- Build and push Docker images with cache enabled inside a pipeline.
- Write a Jenkinsfile that builds a multistage image and publishes only the final stage.
- Automate deployment of a containerized app to a test environment after build.
- Write a GitLab CI job that deploys a container on a remote server via SSH.
- Write a Jenkins pipeline that scales an app by running multiple container instances.
- Add a pipeline stage that removes old containers before deploying new ones.
- Configure pipelines to use docker-compose for multi-container deployment.
- Write a Jenkins pipeline that runs a vulnerability scan on the built image.
- Write a GitLab CI job that runs docker scan and fails if vulnerabilities are found.
- Store pipeline logs inside a container volume for later inspection.
- Add resource limits to a container deployment inside the pipeline.
- Parameterize the pipeline with image version and registry name.
- Document best practices for Docker in CI/CD pipelines (immutable builds, caching, registry cleanup).
Advanced Questions
- Write a complete Jenkins pipeline that checks out code, builds a Docker image, runs tests, pushes to registry, and deploys to a server.
- Extend the Jenkins pipeline to include notifications (Slack/Email) after successful deployment.
- Write a GitLab CI pipeline with stages: lint → build → test → dockerize → deploy.
- Implement a GitHub Actions pipeline that builds, tags, and pushes an image to GitHub Container Registry.
- Automate zero-downtime deployment using Docker in a Jenkins pipeline.
- Build and deploy an app using Docker Compose inside a pipeline.
- Write a Jenkins pipeline that uses Kubernetes plugin to deploy a Dockerized app on EKS.
- Write a GitLab pipeline that builds a Docker image and deploys it on a Kubernetes cluster using kubectl.
- Integrate Docker best practices: use .dockerignore, multistage builds, and minimal base images inside a pipeline.
- Deliver a full hands-on project: Jenkins Pipeline → Build Dockerized App → Push to Docker Hub → Deploy on Server → Validate deployment → Send notification.