{"id":8700,"date":"2020-01-14T06:49:20","date_gmt":"2020-01-14T06:49:20","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=8700"},"modified":"2025-02-01T23:03:14","modified_gmt":"2025-02-01T23:03:14","slug":"docker-interview-questions-and-answer-part-4","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/docker-interview-questions-and-answer-part-4\/","title":{"rendered":"Docker Interview Questions and Answer Part \u2013 4"},"content":{"rendered":"\n<p><strong>Which of the following will display the specific command that created each layer in an image?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker search imagename<\/li><li>docker images -t imagename<\/li><li><strong>docker history imagename (Ans)<\/strong><\/li><li>docker build -th imagename<\/li><\/ul>\n\n\n\n<p><strong>You would prepare an image called hello-world for uploading to a local Docker Registry using which of the following commands?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker tag hello-world localhost\/hello-world:latest<\/li><li>docker -tag 127.0.0.1\/hello-world:latest<\/li><li>docker -t hello-world localhost:5000\/hello-world:latest<\/li><li><strong>docker tag hello-world localhost:5000\/hello-world:latest (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Where are the image files stored on a Linux machine running a package-based Docker Registry?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\/var\/lib\/docker\/docker-registry\/docker\/registry\/v2\/repositories (Ans)<\/strong><\/li><li>\/var\/lib\/docker\/docker-registry\/docker\/registry\/v2\/_catalog<\/li><li>\/var\/lib\/docker\/volumes\/\/_data\/docker\/registry\/v2\/repositories\/<\/li><li>\/var\/lib\/docker\/docker-registry<\/li><\/ul>\n\n\n\n<p><strong>Which of these commands will return a list of images currently stored in a Docker Registry?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>curl 192.168.1.17:5000\/v2\/_data<\/li><li><strong>curl 192.168.1.17:5000\/v2\/_catalog (Ans)<\/strong><\/li><li>docker images<\/li><li>docker registry ls<\/li><\/ul>\n\n\n\n<p><strong>To add encryption using a self-signed certificate to your Docker Registry infrastructure, to which directory must the certificate be copied (assuming your domain is domain.com)?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\/etc\/docker\/cert.d\/domain.com:5000\/<\/li><li>\/var\/lib\/docker\/certs.d\/domain.com:5000\/<\/li><li><strong>\/etc\/docker\/certs.d\/domain.com:5000\/ (Ans)<\/strong><\/li><li>\/etc\/docker\/certs.d\/domain.com\/<\/li><\/ul>\n\n\n\n<p><strong>How do you temporarily enable Docker Content Trust on your local machine to take advantage of digitally signed images?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>export $DOCKER_CONTENT_TRUST=0<\/li><li><strong>export DOCKER_CONTENT_TRUST=1 (Ans)<\/strong><\/li><li>echo $DOCKER_CONTENT_TRUST=1<\/li><li>echo DOCKER_CONTENT_TRUST=1 &gt;&gt; \/etc\/profile<\/li><\/ul>\n\n\n\n<p><strong>Which of the following will upload a new stack to your Docker Cloud account?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker-cloud stack create -f dockerfile<\/li><li>docker-cloud stack create docker-cloud.yml<\/li><li>docker stack create -f docker-cloud.yml<\/li><li><strong>docker-cloud stack create -f docker-cloud.yml (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Docker Engine is:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>An online Docker image repository<\/li><li>An online Docker administration interface<\/li><li><strong>The locally installed runtime through which you administrate Docker containers (Ans)<\/strong><\/li><li>A local Docker image repository<\/li><\/ul>\n\n\n\n<p><strong>Docker Trusted Registry is:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>An open source tool for securing the infrastructure on which Docker Engine runs<\/li><li>An open source tool for coordinating Docker container clusters<\/li><li><strong>A web-based, commercial, hosted image management tool (Ans)<\/strong><\/li><li>A local, commercial image management tool<\/li><\/ul>\n\n\n\n<p><strong>A Docker container will run faster when its image is properly optimized. Which of the following will have the greatest positive impact on speed?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Build the image using as few layers as possible. (Ans)<\/strong><\/li><li>Always base your images on the latest operating system version available.<\/li><li>Build the image using a Dockerfile rather than from a running container.<\/li><li>Always be consistent in the software package versions you choose for your image layers<\/li><\/ul>\n\n\n\n<p><strong>Which of the following commands will successfully build an image with the name &#8220;myimage&#8221;?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>docker build -t myimage . (Ans)<\/strong><\/li><li>docker build &#8211;tag-image myimage<\/li><li>docker build -t myimage<\/li><li>docker build -n myimage .<\/li><\/ul>\n\n\n\n<p><strong>What is accomplished by running the following command?<br> docker run -p 5000:5000 registry:latest<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Only if the Docker Registry image has already been pulled will it be run, exposing port 5000.<\/li><li><strong>The Docker Registry image will (if necessary) be pulled and then run, exposing port 5000. (Ans)<\/strong><\/li><li>Docker Engine will run a &#8220;hot update&#8221; on the live Registry image.<\/li><li>The Docker Registry image will be pulled from Docker Hub using port 5000.<\/li><\/ul>\n\n\n\n<p><strong>Which of these is the correct command to display a list images currently stored in a Docker Registry using a self-signed certificate? <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>curl -i https:\/\/192.168.1.16:5000\/v2\/_data<\/li><li>curl -i https:\/\/192.168.1.16:5000\/v2\/_catalog<\/li><li>curl &#8211;insecure http:\/\/192.168.1.16:5000\/v2\/_catalog<\/li><li><strong>curl &#8211;insecure https:\/\/192.168.1.16:5000\/v2\/_catalog (Ans)<\/strong><\/li><\/ul>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_34687\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_31191\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_34687\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Which of the following will display the specific command that created each layer in an image? docker search imagename docker images -t imagename docker history imagename (Ans)&#8230; <\/p>\n","protected":false},"author":1,"featured_media":8726,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[333,567,5673,4971],"class_list":["post-8700","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-command","tag-docker","tag-docker-cloud-account","tag-docker-registry"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=8700"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8700\/revisions"}],"predecessor-version":[{"id":25142,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8700\/revisions\/25142"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/8726"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=8700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=8700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=8700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}