{"id":8979,"date":"2020-01-18T06:40:20","date_gmt":"2020-01-18T06:40:20","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=8979"},"modified":"2025-02-01T23:03:13","modified_gmt":"2025-02-01T23:03:13","slug":"docker-interview-questions-and-answer-part-9","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/docker-interview-questions-and-answer-part-9\/","title":{"rendered":"Docker Interview Questions and Answer Part \u2013 9"},"content":{"rendered":"\n<p><strong>Where does the file system come from for a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>From a remote network share hosted through Hyper-V<\/li><li>From the machine the container is started on<\/li><li><strong>From the image used to create the container (Ans)<\/strong><\/li><li>From another special container called a parent container<\/li><\/ul>\n\n\n\n<p><strong>What image type is blessed by both Docker and the people behind the software it contains?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Trusted<\/li><li>Blessed<\/li><li><strong>Official (Ans)<\/strong><\/li><li>Automated Build<\/li><\/ul>\n\n\n\n<p><strong>How can you get files out of a container onto the host? Assume a process in a container is writing files, like ffmpeg saving the contents of a converted video. Where do you write this data?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Write files to the default host file system mounts at C:\\host or \/mnt\/host on Linux<\/li><li><strong>Write files to a volume mounted from the host (Ans)<\/strong><\/li><li>Write files to network shares<\/li><li>Write files to the container file system, all writes are automatically copied to the host file system in the same folder<\/li><\/ul>\n\n\n\n<p><strong>How can you see the output of a process running in a detached container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker run -it<\/li><li><strong>docker logs (Ans)<\/strong><\/li><li>docker ls<\/li><li>docker exec -it<\/li><li>docker output<\/li><\/ul>\n\n\n\n<p><strong>Why do containers exist?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>To make it easier to use virtual machines<\/li><li>A replacement for monolithic operating systems<\/li><li>A replacement for virtual machines<\/li><li><strong>To make it easier to use software (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Which of the following allows you to add files from the host to a running container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>docker cp (Ans)<\/strong><\/li><li>docker share<\/li><li>docker commit<\/li><li>docker volumes<\/li><li>docker add<\/li><\/ul>\n\n\n\n<p><strong>Which of the following is a good analogy for creating a container? <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Running software<\/li><li><strong>Installing software (Ans)<\/strong><\/li><li>Extracting a zip file<\/li><li>Downloading software<\/li><\/ul>\n\n\n\n<p><strong>What is a repository on Docker Hub?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A single image<\/li><li><strong>A collection of images (Ans)<\/strong><\/li><li>An image ta<\/li><li>A user account<\/li><\/ul>\n\n\n\n<p><strong>On a computer, with either Linux or Windows installed, there&#8217;s a program that runs in a privileged mode that abstracts hardware and provides services to other processes. What is this program?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Application<\/li><li>User space<\/li><li>User<\/li><li>Kernel space<\/li><li><strong>Kernel (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>What does docker-compose help us avoid? Excessive calls to <em>__<\/em>?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker pull<\/li><li>docker stop<\/li><li>docker build<\/li><li>docker rm<\/li><li><strong>docker run (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>How can I run another process inside a running container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker start<\/li><li>docker ps<\/li><li><strong>docker exec (Ans)<\/strong><\/li><li>docker run<\/li><\/ul>\n\n\n\n<p><strong>What does an image contain? <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>The user space files (Ans)<\/strong><\/li><li>The operating system<\/li><li>Only an application&#8217;s files<\/li><li>Both the user and kernel space files<\/li><li>The kernel space files<\/li><\/ul>\n\n\n\n<p><strong>On Windows 10 which container types can you run?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Hyper-V Containers (Ans)<\/strong><\/li><li>Both Hyper-V and Windows Server Containers<\/li><li>Windows 10 Containers<\/li><li>Windows Server Containers<\/li><\/ul>\n\n\n\n<p><strong>What is a dangling image? <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>An intermediate part of the chain of image layers<\/li><li>An image that&#8217;s not associated with a volume<\/li><li><strong>An image that&#8217;s not associated with a tag (Ans)<\/strong><\/li><li>An image that&#8217;s not associated with a running container<\/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>Install a container<\/li><li><strong>Runs an executable (Ans)<\/strong><\/li><li>Pull a container<\/li><li>Create a container<\/li><\/ul>\n\n\n\n<p><strong>How can processes in different containers talk to each other when using docker-compose?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Pass IP addresses in configuration files<\/li><li><strong>Embedded DNS for Service Discovery (Ans)<\/strong><\/li><li>Linking containers<\/li><li>Pass IP addresses in environment variables<\/li><\/ul>\n\n\n\n<p><strong>What&#8217;s a good analogy for <code>docker exec<\/code>?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>It&#8217;s similar to installing software<\/li><li><strong>Allows you to run additional processes in a container (Ans)<\/strong><\/li><li>Allows you to run additional processes outside a container<\/li><li>Allows you to run additional processes in new containers<\/li><\/ul>\n\n\n\n<p><strong>To get Ctrl+C to work to kill a container, what should you pass when running the container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>-it (Ans)<\/strong><\/li><li>&#8211;name<\/li><li>-d<\/li><li>-p<\/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<br> 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><strong>gra (Ans)<\/strong><\/li><li>grave_tesla<\/li><li>57cf9c689955<\/li><\/ul>\n\n\n\n<p><strong>What&#8217;s the primary purpose of docker-compose?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Pull and push images<\/li><li>Build containers<\/li><li><strong>Build containers, volumes, and networks (Ans)<\/strong><\/li><li>Build images<\/li><li>Cleanup containers.<\/li><\/ul>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_23256\"><iframe loading=\"lazy\"  id=\"_ytid_74455\"  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_23256\"  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>Where does the file system come from for a container? From a remote network share hosted through Hyper-V From the machine the container is started on From the image used&#8230; <\/p>\n","protected":false},"author":1,"featured_media":9824,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[567],"class_list":["post-8979","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\/8979","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=8979"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8979\/revisions"}],"predecessor-version":[{"id":25088,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/8979\/revisions\/25088"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/9824"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=8979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=8979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=8979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}