QuestionQ78

DevSecOps Pipeline-Code Stage

Lara Grice works as a DevSecOps engineer at an IT company based in Denver, Colorado. Her team leader has instructed her to save all the container images in the centos repository into a file named centos-all.tar.

Which STDOUT command can Lara use to save all the container images in the centos repository to centos-all.tar?

  • A

    docker save centos < centos all.tar

  • B

    docker save centos > centos all.tar

  • C

    docker save centos > centos-all.tar

  • D

    docker save centos < centos-all.tar

Explanation

The docker save command streams a tar archive of the specified image(s) to standard output by default. To capture this STDOUT stream into a file, you use the shell redirection operator >, as in docker save centos > centos-all.tar. The < operator instead redirects a file's content into a command's standard input, which is the opposite of what is needed here, and would not correctly capture the image data into the tar file. The file name must exactly match centos-all.tar as required by the task, ruling out variants with a space instead of a hyphen.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!