{"id":9129,"date":"2020-01-21T10:24:30","date_gmt":"2020-01-21T10:24:30","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=9129"},"modified":"2025-07-12T05:41:46","modified_gmt":"2025-07-12T05:41:46","slug":"docker-interview-questions-and-answer-part-30","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/docker-interview-questions-and-answer-part-30\/","title":{"rendered":"Docker Interview Questions and Answer Part \u2013 30"},"content":{"rendered":"\n<p><strong>Images contain the entire user space, in other words the entire file system for a container. How is this not horribly inefficient in terms of disk space?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Images are layered and common layers are shared (Ans)<\/strong><\/li><li>Images use state of the art compression to reduce the disk space requirements<\/li><li>You only pull down the image layers that you need to run your application<\/li><li>Image layers are highly optimized to reduce unnecessary components.<\/li><\/ul>\n\n\n\n<p><strong>Say you have the following output from docker ps:<br>     57cf9c689955 docs\/docker.github.io &#8220;\/bin\/sh -c &#8216;jekyll s&#8221; About an hour ago Exited (137) About an hour ago grave_tesla<\/strong><\/p>\n\n\n\n<p><strong>Which of the following does not work as a container identifier (CID) when running a command like the following?<br>    docker stop <br>    docker start <br>    docker rm <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>57<\/li><li>57cf9c689955<\/li><li>grave_tesla<\/li><li><strong>gra (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>How do you terminate software running in a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>docker stop (Ans)<\/strong><\/li><li>docker rm<\/li><li>docker terminate<\/li><li>docker kill<\/li><\/ul>\n\n\n\n<p><strong>Which of the following Windows Features do you need to use Windows Server containers?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Docker<\/li><li><strong>Containers (Ans)<\/strong><\/li><li>Hyper-V and Containers<\/li><li>Hyper-V<\/li><\/ul>\n\n\n\n<p><strong>Which of the following stops all running containers?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>docker stop $(docker ps -q) (Ans)<\/strong><\/li><li>docker rmi $(docker ps -q)<\/li><li>docker halt $(docker ps -q)<\/li><li>docker rm -f $(docker ps -q)<\/li><\/ul>\n\n\n\n<p><strong>Where do dangling volumes typically come from?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Containers that we manually mount managed volumes into<\/li><li><strong>Images that have a VOLUME instruction (Ans)<\/strong><\/li><li>Containers that we bind-mount host volumes into<\/li><li>Every container that is created has a volume created as well<\/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 bottom most layer from the image it was created from<\/li><li>In the top most layer from the image it was created from<\/li><\/ul>\n\n\n\n<p><strong>In the past, to launch an installed application, we would run an executable file. How does Docker run software?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Pull a container<\/li><li>Install a container<\/li><li><strong>Runs an executable (Ans)<\/strong><\/li><li>Create a container<\/li><\/ul>\n\n\n\n<p><strong>How are image layers coalesced to form a container&#8217;s file system?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Files are copied out of layers when creating a container into a union mount point<\/li><li><strong>A union file system is used to create a union mount point (Ans)<\/strong><\/li><li>Container file systems exist in memory, in a RAM disk, aggregated from image layers<\/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>&#8211;udf NETWORK_NAME<\/li><li>docker connect<\/li><li><strong>&#8211;net NETWORK_NAME (Ans)<\/strong><\/li><li>docker attach<\/li><li>docker disconnect<\/li><\/ul>\n\n\n\n<p><strong>In traditional software management, we uninstall software to remove it from a machine, what&#8217;s the equivalent with Docker?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Remove an image<\/li><li>Uninstall a container<\/li><li><strong>Remove a container (Ans)<\/strong><\/li><li>Stop an image<\/li><li>Stop 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>The contents of all layers flattened into one folder<\/li><li>A folder for the entire image and also a layers folder with each layer nested inside<\/li><li><strong>A folder for each image layer (Ans)<\/strong><\/li><\/ul>\n\n\n\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 ps<\/li><li>docker images<\/li><li>docker-compose.yml<\/li><li>docker layers<\/li><\/ul>\n\n\n\n<p><strong>What is the role of Docker images?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>All of these<\/li><li>Used to execute code at runtime<\/li><li>Provides virtualization functionality across environments<\/li><li><strong>Acts as a blueprint or template that is used to create containers (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>What command can be used to start a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker run [<a href=\"Ans\">image name<\/a>](Ans)<\/li><li>docker go [image name]<\/li><li>docker rm [image name]<\/li><li>docker ps -a<\/li><\/ul>\n\n\n\n<p><strong>Which of the following tasks can Docker Compose perform?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>View service logs<\/li><li>None of these<\/li><li>Build services<\/li><li><strong>All of these (Ans)<\/strong><\/li><li>Start and stop containers<\/li><\/ul>\n\n\n\n<p><strong>Services can be organized into __ with Docker Cloud.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>groups<\/li><li><strong>stacks (Ans)<\/strong><\/li><li>roles<\/li><li>zones<\/li><\/ul>\n\n\n\n<p><strong>What Docker Compose command can be used to start multiple service containers?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>docker-compose up (Ans)<\/strong><\/li><li>docker-compose start<\/li><li>None of these<\/li><li>docker run<\/li><\/ul>\n\n\n\n<p><strong>A Docker <em>_<\/em> has a &#8220;thin R\/W layer.&#8221;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>File<\/li><li>Image<\/li><li>None of these<\/li><li><strong>Container (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Each instruction in a Dockerfile creates an intermediate container as the image is built.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>True (Ans)<\/strong><\/li><li>False<\/li><\/ul>\n\n\n\n<p><strong>What syntax can be used to convert a Dockerfile into an Image?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker create -t \/tagName .<\/li><li>docker run -t \/tagName .<\/li><li><strong>docker run -t \/tagName . (Ans)<\/strong><\/li><li>docker convert -t \/tagName .<\/li><\/ul>\n\n\n\n<p><strong>Which of the following tools are included in Docker Toolbox?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>All of these (Ans)<\/strong><\/li><li>Docker Machine<\/li><li>Docker Client<\/li><li>VirtualBox<\/li><li>Docker Kitematic<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><\/li><\/ul>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_15009\"><iframe loading=\"lazy\"  id=\"_ytid_73600\"  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_15009\"  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>Images contain the entire user space, in other words the entire file system for a container. How is this not horribly inefficient in terms of disk space? Images are layered&#8230; <\/p>\n","protected":false},"author":1,"featured_media":9476,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[],"class_list":["post-9129","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9129","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=9129"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9129\/revisions"}],"predecessor-version":[{"id":25020,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9129\/revisions\/25020"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/9476"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=9129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=9129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=9129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}