0
0
Dockerdevops~20 mins

Pushing images from CI in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker CI Image Pusher
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this Docker login command in CI?
You run this command in your CI pipeline to authenticate with Docker Hub:
docker login -u $DOCKER_USER -p $DOCKER_PASS

What will be the output if the credentials are correct?
Docker
docker login -u $DOCKER_USER -p $DOCKER_PASS
AError: Cannot perform an interactive login from a non TTY device
BError: Invalid username or password
CWarning: Using --password via the CLI is insecure
DLogin Succeeded
Attempts:
2 left
💡 Hint
Think about what Docker shows when login is successful.
Configuration
intermediate
2:00remaining
Which GitHub Actions step correctly pushes a Docker image to Docker Hub?
You want to push a Docker image from GitHub Actions to Docker Hub. Which step configuration will work correctly?
A
- name: Push image
  run: |
    docker push myuser/myimage:latest
  env:
    DOCKER_USER: ${{ secrets.DOCKER_USER }}
    DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
B
- name: Push image
  run: |
    docker push myuser/myimage
  env:
    DOCKER_USER: ${{ secrets.DOCKER_USER }}
    DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
C
- name: Push image
  run: |
    docker push myuser/myimage:latest
D
- name: Push image
  run: |
    docker push myuser/myimage:latest
  env:
    USERNAME: ${{ secrets.DOCKER_USER }}
    PASSWORD: ${{ secrets.DOCKER_PASS }}
Attempts:
2 left
💡 Hint
Check if the image tag is specified and environment variables match Docker login.
Troubleshoot
advanced
2:00remaining
Why does this CI pipeline fail to push the Docker image?
In your CI pipeline, you run:
docker build -t myuser/myimage:latest .
docker push myuser/myimage:latest

The push fails with:
denied: requested access to the resource is denied
What is the most likely cause?
AThe Dockerfile has syntax errors causing build failure
BDocker Hub credentials are missing or incorrect in the CI environment
CThe image tag 'latest' is not allowed by Docker Hub
DThe Docker daemon is not running on the CI server
Attempts:
2 left
💡 Hint
Think about permissions needed to push images to Docker Hub.
🔀 Workflow
advanced
2:30remaining
What is the correct order of steps to push a Docker image in a CI pipeline?
Arrange these steps in the correct order to push a Docker image from a CI pipeline:
A4,3,1,2
B4,3,2,1
C4,2,3,1
D2,4,3,1
Attempts:
2 left
💡 Hint
Think about setting credentials before login, then build, then push.
Best Practice
expert
3:00remaining
Which practice is best to securely push Docker images from CI?
You want to push Docker images from your CI pipeline securely. Which practice is best?
AStore Docker Hub credentials as encrypted secrets in the CI system and use docker login with them
BHardcode Docker Hub username and password in the CI pipeline script for simplicity
CPush images without authentication to a public Docker Hub repository
DUse plain text environment variables in the CI logs for easy debugging
Attempts:
2 left
💡 Hint
Think about security and secret management best practices.