Bird
0
0

Which of the following is the correct syntax to build a Docker image inside a GitHub Actions workflow step?

easy📝 Syntax Q12 of 15
Docker - in CI/CD
Which of the following is the correct syntax to build a Docker image inside a GitHub Actions workflow step?
Arun: docker start -t myimage .
Brun: docker create myimage .
Crun: docker push -t myimage .
Drun: docker build -t myimage .
Step-by-Step Solution
Solution:
  1. Step 1: Recall Docker build command

    The command to build an image is 'docker build' with '-t' to tag the image.
  2. Step 2: Match with GitHub Actions step syntax

    In GitHub Actions, 'run:' is used to run shell commands, so 'run: docker build -t myimage .' is correct.
  3. Final Answer:

    run: docker build -t myimage . -> Option D
  4. Quick Check:

    Build image command = C [OK]
Quick Trick: Use 'docker build -t name .' to build images [OK]
Common Mistakes:
  • Using 'docker create' instead of 'docker build'
  • Confusing 'docker start' with building images
  • Using 'docker push' to build images

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes