{"id":9120,"date":"2020-01-21T10:07:23","date_gmt":"2020-01-21T10:07:23","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=9120"},"modified":"2025-02-01T23:03:12","modified_gmt":"2025-02-01T23:03:12","slug":"docker-interview-questions-and-answer-part-26","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/docker-interview-questions-and-answer-part-26\/","title":{"rendered":"Docker Interview Questions and Answer Part \u2013 26"},"content":{"rendered":"\n<p><strong>What Docker Client command can be used to convert a Dockerfile into an Image?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker createimage<\/li><li>docker buildimage<\/li><li><strong>docker build (Ans)<\/strong><\/li><li>docker create<\/li><\/ul>\n\n\n\n<p><strong>Which of the following statements accurately describe a Docker volume?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Persisted even after a container is deleted<\/li><li><strong>All of these (Ans)<\/strong><\/li><li>Can be shared and reused among containers<\/li><li>Special type of directory in a container<\/li><li>Are not affected by updates to images<\/li><\/ul>\n\n\n\n<p><strong>Which option can we pass to the Docker daemon to make it assign the Docker bridge a specific IP range?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>&#8211;bip (Ans)<\/strong><\/li><li>&#8211;network<\/li><li>&#8211;ip-range<\/li><li>&#8211;cidr<\/li><\/ul>\n\n\n\n<p><strong>Which Dockerfile Instruction is the preferred instruction for setting the main process to run inside a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>DEFAULT<\/li><li><strong>ENTRYPOINT (Ans)<\/strong><\/li><li>CMD<\/li><li>RUN<\/li><\/ul>\n\n\n\n<p><strong>Which command shows us detailed container info including the containers PID within the Docker Hosts process tree?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker config <\/li><li>docker detail <\/li><li><strong>docker inspect  (Ans)<\/strong><\/li><li>docker pid <\/li><\/ul>\n\n\n\n<p><strong>When using the ENTRYPOINT Instruction in a Dockerfile, how are CMD Instructions treated?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>CMD Instructions are treated as arguments to the ENTRYPOINT Instruction (Ans)<\/strong><\/li><li>CMD Instructions override ENTRYPOINT Instructions<\/li><li>ENTRYPOINT Instructions are ignored<\/li><li>CMD Instructions are ignored<\/li><\/ul>\n\n\n\n<p><strong>Which Dockerfile Instruction do we use to install packages to our new Image?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>FROM<\/li><li><strong>RUN (Ans)<\/strong><\/li><li>apt-get install<\/li><li>CMD<\/li><\/ul>\n\n\n\n<p><strong>What is the name of the primary virtual Ethernet NIC inside of each Docker container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>veth0<\/li><li>eth1<\/li><li>veth1<\/li><li><strong>eth0 (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Which Docker command lets us attach to a running container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker ssh <\/li><li>docker login <\/li><li>docker telnet <\/li><li><strong>docker attach  (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Which of the following docker run commands will start a Container based on an Ubuntu 14.04 Base Image?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker run Ubuntu:14.04 \u2026.<\/li><li>docker run ubuntu -v 14.04 \u2026..<\/li><li><strong>docker run ubuntu:14.04 \u2026. (Ans)<\/strong><\/li><li>docker run ubuntu &#8211;version=14.04 \u2026.<\/li><\/ul>\n\n\n\n<p><strong>Which of the following commands will install the Docker engine on an Ubuntu server?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>cf install docker.io<\/li><li>rkt install docker<\/li><li>yum install docker<\/li><li><strong>apt-get install docker.io (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>Virtual Machines are a form of what type of virtualization?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Container<\/li><li><strong>Hypervisor (Ans)<\/strong><\/li><li>VLAN<\/li><li>Mainframe<\/li><\/ul>\n\n\n\n<p><strong>How do recipient containers learn about the networking config of source containers they are linked to?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>By querying the Docker daemon<\/li><li>Via a sub-space secure channel to the source container<\/li><li><strong>Environment variables + entries in the \/etc\/hosts file (Ans)<\/strong><\/li><li>The \/link file in the root filesystem of the container<\/li><\/ul>\n\n\n\n<p><strong>Which of the following commands will show version information for the various installed Docker components?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>docker version (Ans)<\/strong><\/li><li>apt-get update<\/li><li>docker detail<\/li><li>rkt version<\/li><\/ul>\n\n\n\n<p><strong>Which Docker command builds a new image from a Dockerfile in the current directory?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker build<\/li><li>docker build-image .<\/li><li>docker image .<\/li><li><strong>docker build . (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>What does pressing Control+P+Q inside of a container do?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Issues a print-screen of the current contents of the terminal window<\/li><li><strong>Detaches the Docker Hosts terminal from the container (Ans)<\/strong><\/li><li>Kills the container<\/li><li>Generates a stack trace of the container<\/li><\/ul>\n\n\n\n<p><strong>Which Docker command shows running Docker Containers?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>docker ps (Ans)<\/strong><\/li><li>docker list containers<\/li><li>docker show containers<\/li><li>rkt ps<\/li><\/ul>\n\n\n\n<p><strong>Which of the following is a major advantage of Containers over Virtual Machines?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Containers are more lightweight than Virtual Machines. (Ans)<\/strong><\/li><li>Containers are encrypted by default.<\/li><li>A single Container can host more apps than a Virtual Machine.<\/li><li>Containers are cross-platform.<\/li><\/ul>\n\n\n\n<p><strong>Which of the following is an advantage of Linking Containers when compared to exposing ports?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Linking containers is more efficient on memory.<\/li><li>Linking containers allow more active network connections.<\/li><li>Linking containers allows for faster container startup times.<\/li><li><strong>Linking containers is considered more secure. (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>What is the correct syntax to mount the \/project\/data directory from the Docker host into a directory called \/data in a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker run -v \/data:\/project\/data<\/li><li>docker run -volumes-from \/project\/data:\/data<\/li><li><strong>docker run -v \/project\/data:\/data (Ans)<\/strong><\/li><li>docker run -volumes-from \/data:\/project\/data<\/li><\/ul>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_58069\"><iframe loading=\"lazy\"  id=\"_ytid_13659\"  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_58069\"  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>What Docker Client command can be used to convert a Dockerfile into an Image? docker createimage docker buildimage docker build (Ans) docker create Which of the following statements accurately describe&#8230; <\/p>\n","protected":false},"author":1,"featured_media":9502,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[],"class_list":["post-9120","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\/9120","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=9120"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9120\/revisions"}],"predecessor-version":[{"id":25028,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9120\/revisions\/25028"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/9502"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=9120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=9120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=9120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}