{"id":8973,"date":"2020-01-18T06:34:22","date_gmt":"2020-01-18T06:34:22","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=8973"},"modified":"2025-02-01T23:03:14","modified_gmt":"2025-02-01T23:03:14","slug":"docker-interview-questions-and-answer-part-8","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/docker-interview-questions-and-answer-part-8\/","title":{"rendered":"Docker Interview Questions and Answer Part \u2013 8"},"content":{"rendered":"\n<p><strong>The docker history command shows output similar to which of the following?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Dockerfile (Ans)<\/strong><\/li><li>docker-compose.yml<\/li><li>docker images<\/li><li>docker layers<\/li><li>docker ps<\/li><\/ul>\n\n\n\n<p><strong>What is a tag?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A reference to a registry<\/li><li><strong>A reference to a specific image in a repository (Ans)<\/strong><\/li><li>A reference to a specific image in a registry<\/li><li>A reference to a repository<\/li><\/ul>\n\n\n\n<p><strong>What format does Docker use to export images?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>iso<\/li><li>Image<\/li><li>dmg<\/li><li><strong>tar (Ans)<\/strong><\/li><li>zip<\/li><\/ul>\n\n\n\n<p><strong>Which of the following container types doesn&#8217;t use namespace isolation?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Windows Server Container<\/li><li>Linux Container<\/li><li><strong>Hyper-V Container (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Where do dangling images typically come from?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>When you stop many of the same containers<\/li><li><strong>When building custom docker images (Ans)<\/strong><\/li><li>When running lots of containers from the same image<\/li><li>When downloading images from Docker hub<\/li><\/ul>\n\n\n\n<p><strong>In the past, we usually downloaded software in some sort of package to install it, for example a zip file or MSI file. Now, with Docker, how do we download software?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>docker start<\/code><\/li><li><code>docker download<\/code><\/li><li><strong><code>docker pull<\/code> (Ans)<\/strong><\/li><li><code>docker ps<\/code><\/li><\/ul>\n\n\n\n<p><strong>Where are created, modified, and deleted files stored in a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>In a volume mounted in the container<\/li><li><strong>In an R\/W container layer (Ans)<\/strong><\/li><li>In the top most layer from the image it was created from<\/li><li>In the bottom most layer from the image it was created from<\/li><\/ul>\n\n\n\n<p><strong>How can you connect a container to a user defined network?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker attach<\/li><li>docker connect<\/li><li><strong>&#8211;net NETWORK_NAME (Ans)<\/strong><\/li><li>&#8211;udf NETWORK_NAME<\/li><li>docker disconnect<\/li><\/ul>\n\n\n\n<p><strong>What is used to resolve ip addresses with the embedded DNS in user-defined networks? What value is pulled from the docker-compose.yml file?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Image name<\/li><li><strong>Service name (Ans)<\/strong><\/li><li>environment<\/li><li>DNS name<\/li><\/ul>\n\n\n\n<p><strong>Why are image layers read only?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>So they can be reused (Ans)<\/strong><\/li><li>So we cannot write data inside a container<\/li><li>So they can be compressed to reduce disk space<\/li><\/ul>\n\n\n\n<p><strong>What is a Docker volume?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The host file system<\/li><li>A directory that mounts remote files<\/li><li><strong>A directory that bypasses the container&#8217;s union file system (Ans)<\/strong><\/li><li>The union file system for a container<\/li><\/ul>\n\n\n\n<p><strong>When you extract an image with docker save what is inside the tar archive?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A folder for the entire image and also a layers folder with each layer nested inside<\/li><li>The contents of all layers flattened into one folder<\/li><li><strong>A folder for each image layer (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>In the past we had to install software before we could run it. What is the equivalent step with Docker to be able to run software?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Create a container (Ans)<\/strong><\/li><li>Pulls a container<\/li><li>Run a container<\/li><li>Installs a container<\/li><\/ul>\n\n\n\n<p><strong>Which of the following is an accurate statement about processes in a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Container processes do not show in the Windows Task Manager<\/li><li>Container processes run in a VM<\/li><li>Container processes are different from machine processes<\/li><li><strong>Container processes are regular machine processes (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>When executing the command &#8220;docker pull microsoft\/aspnet:4.6.2&#8221; what does &#8220;microsoft\/aspnet:4.6.2&#8221; refer to?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Repository<\/li><li>User<\/li><li>Registry<\/li><li>Tag<\/li><li><strong>Image (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>When using docker-compose, by default, what network are linux containers connected to?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>none<\/li><li>host<\/li><li>bridge<\/li><li><strong>user defined network (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Why does Docker for Windows need Hyper-V?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>To run linux containers inside a linux VM and Hyper-V windows containers (Ans)<\/strong><\/li><li>To run windows containers inside a Windows Server VM and linux containers inside a linux VM<\/li><li>To run linux containers inside a linux VM<\/li><li>To run windows containers inside a Windows Server VM<\/li><\/ul>\n\n\n\n<p><strong>How is it possible that we can run a command prompt in a container created from the microsoft\/dotnet image?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>We have access to all apps on the machine in addition to those in the container<\/li><li>Common OS applications like CMD.exe are mapped into the container by default<\/li><li>It&#8217;s not possible to run anything but the one application provided by the image<\/li><li><strong>The image also provides CMD.exe (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>After stopping a container, how do you run the application in it again?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker run <\/li><li><strong>docker start  (Ans)<\/strong><\/li><li>docker pull <\/li><li>docker restart <\/li><\/ul>\n\n\n\n<p><strong>What does the -d in docker run -d nginx do?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Deletes the container when we stop the NGINX proces<\/li><li>Runs an attached container<\/li><li>Runs a container that will display output from the NGINX process in our console<\/li><li><strong>Runs a detached container (Ans)<\/strong><\/li><\/ul>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_87223\"><iframe loading=\"lazy\"  id=\"_ytid_15319\"  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_87223\"  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 class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>The docker history command shows output similar to which of the following? Dockerfile (Ans) docker-compose.yml docker images docker layers docker ps What is a tag? A reference to a registry&#8230; <\/p>\n","protected":false},"author":1,"featured_media":9823,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[567],"class_list":["post-8973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-docker"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8973","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=8973"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8973\/revisions"}],"predecessor-version":[{"id":25089,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8973\/revisions\/25089"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/9823"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=8973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=8973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=8973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}