Docker Assignment– 5

Docker in CI/CD & DevOps

Basic Questions

  1. Install Docker on a Jenkins server and verify it is available to pipelines.
  2. Install Docker on a GitLab Runner and verify it is available to jobs.
  3. Write a simple Jenkins pipeline that prints docker –version.
  4. Write a GitLab CI job that prints docker ps -a.
  5. Create a Dockerfile for a simple Node.js app.
  6. Build the image locally using docker build -t myapp:v1 ..
  7. Push the image to Docker Hub manually.
  8. Write a Jenkins pipeline stage that builds the myapp:v1 image.
  9. Write a GitLab CI job that builds the myapp:v1 image.
  10. Write a GitHub Actions workflow job that builds the myapp:v1 image.
  11. Add a pipeline step that pushes the built image to Docker Hub.
  12. Use a .env file in the pipeline to pass Docker Hub credentials.
  13. Tag an image with both latest and v1 inside a pipeline.
  14. Add a step to remove dangling images in a pipeline (docker image prune -f).
  15. Automate running a container after building the image inside a pipeline.
  16. Write a Jenkins pipeline that echoes “Build Completed” after Docker build.
  17. Use docker login inside a pipeline with stored credentials.
  18. Set up a multistage Dockerfile and build it in a pipeline.
  19. Inspect the layers of the built image in a pipeline step.
  20. Document Docker best practices: small base image, caching, .dockerignore.

Intermediate Questions

  1. Write a Jenkins pipeline with stages: Checkout → Build Docker Image → Push to Registry.
  2. Write a GitLab CI/CD pipeline that builds a Docker image on merge requests.
  3. Configure GitHub Actions to build a Docker image when code is pushed to main.
  4. Write a Jenkins pipeline that runs tests inside a container after building.
  5. Write a GitLab CI job that deploys the container after building.
  6. Configure a Jenkins pipeline to build different image tags based on branch name.
  7. Write a GitLab CI job that pushes Docker images to a private GitLab Container Registry.
  8. Build and push Docker images with cache enabled inside a pipeline.
  9. Write a Jenkinsfile that builds a multistage image and publishes only the final stage.
  10. Automate deployment of a containerized app to a test environment after build.
  11. Write a GitLab CI job that deploys a container on a remote server via SSH.
  12. Write a Jenkins pipeline that scales an app by running multiple container instances.
  13. Add a pipeline stage that removes old containers before deploying new ones.
  14. Configure pipelines to use docker-compose for multi-container deployment.
  15. Write a Jenkins pipeline that runs a vulnerability scan on the built image.
  16. Write a GitLab CI job that runs docker scan and fails if vulnerabilities are found.
  17. Store pipeline logs inside a container volume for later inspection.
  18. Add resource limits to a container deployment inside the pipeline.
  19. Parameterize the pipeline with image version and registry name.
  20. Document best practices for Docker in CI/CD pipelines (immutable builds, caching, registry cleanup).

Advanced Questions

  1. Write a complete Jenkins pipeline that checks out code, builds a Docker image, runs tests, pushes to registry, and deploys to a server.
  2. Extend the Jenkins pipeline to include notifications (Slack/Email) after successful deployment.
  3. Write a GitLab CI pipeline with stages: lint → build → test → dockerize → deploy.
  4. Implement a GitHub Actions pipeline that builds, tags, and pushes an image to GitHub Container Registry.
  5. Automate zero-downtime deployment using Docker in a Jenkins pipeline.
  6. Build and deploy an app using Docker Compose inside a pipeline.
  7. Write a Jenkins pipeline that uses Kubernetes plugin to deploy a Dockerized app on EKS.
  8. Write a GitLab pipeline that builds a Docker image and deploys it on a Kubernetes cluster using kubectl.
  9. Integrate Docker best practices: use .dockerignore, multistage builds, and minimal base images inside a pipeline.
  10. Deliver a full hands-on project: Jenkins Pipeline → Build Dockerized App → Push to Docker Hub → Deploy on Server → Validate deployment → Send notification.