{"id":9034,"date":"2020-01-20T07:54:48","date_gmt":"2020-01-20T07:54:48","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=9034"},"modified":"2021-11-13T07:05:49","modified_gmt":"2021-11-13T07:05:49","slug":"docker-interview-questions-and-answer-part-18","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/docker-interview-questions-and-answer-part-18\/","title":{"rendered":"Docker Interview Questions and Answer Part \u2013 18"},"content":{"rendered":"\n<p><strong>If you want to perform maintenance on a node, to what availability should you change it?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ready<\/li><li>Down<\/li><li><strong>Drain (Ans)<\/strong><\/li><li>Pause<\/li><li>Active<\/li><\/ul>\n\n\n\n<p><strong>Assuming you have a stack called APIS, what is the equivalent of docker service ps for stacks?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker stack deploy<\/li><li>docker stack ls<\/li><li><strong>docker stack ps APIS (Ans)<\/strong><\/li><li>docker stack services APIS<\/li><\/ul>\n\n\n\n<p><strong>When a service is updated that requires a change in the running container, what happens to the corresponding task?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The existing task is kept and its metadata is updated.<\/li><li><strong>A new task is also created. (Ans)<\/strong><\/li><li>The existing task is kept.<\/li><\/ul>\n\n\n\n<p><strong>What happens when a new node is attached to the cluster that matches the constraints of a pending replicated service?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>The pending task for the service will be assigned to the new node and a container will be started. (Ans)<\/strong><\/li><li>The existing containers for the service will be rebalanced so that a fair share are placed onto the new node.<\/li><li>A new task will be allocated to the new node for the global service.<\/li><li>Nothing will run on the new node unless you change the service.<\/li><\/ul>\n\n\n\n<p><strong>If you don&#8217;t want a service to run, but you don&#8217;t want to remove it, what&#8217;s the safest thing to do?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Add constraints that aren&#8217;t fulfilled.<\/li><li><strong>Scale it to zero. (Ans)<\/strong><\/li><li>Manually mark it pending.<\/li><\/ul>\n\n\n\n<p><strong>In the &#8220;Manager Status&#8221; column in the output of docker node ls, what shows for worker nodes?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Worker<\/li><li><strong>Nothing (Ans)<\/strong><\/li><li>Leader<\/li><li>Reachable<\/li><\/ul>\n\n\n\n<p><strong>Which service mode puts a task and a container on each node in the cluster?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Global (Ans)<\/strong><\/li><li>Per Node<\/li><li>Replicated<\/li><\/ul>\n\n\n\n<p><strong>Which of the following would you use to stop a health check that&#8217;s running for a long time?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>timeout (Ans)<\/strong><\/li><li>interval<\/li><li>CMD<\/li><li>retries<\/li><\/ul>\n\n\n\n<p><strong>Which node role maintains the state of the cluster?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Manager (Ans)<\/strong><\/li><li>Replica<\/li><li>Slave<\/li><li>Worker<\/li><\/ul>\n\n\n\n<p><strong>Which service mode allows you to arbitrarily scale your service?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Replicated  (Ans)<\/strong><\/li><li>Global<\/li><li>Per Node<\/li><\/ul>\n\n\n\n<p><strong>If you want to convert a manager node into a worker node, what do you use?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>docker node promote<\/li><li><strong>docker node demote (Ans)<\/strong><\/li><li>docker swarm manager<\/li><li>docker swarm worker<\/li><li>docker node rm<\/li><\/ul>\n\n\n\n<p><strong>How are Docker and rkt container images structured on disk?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Each container has access to the host filesystem for common files and then a special directory for apps unique to the container.<\/li><li><strong>Images are typically split into readonly layers that can be shared between containers. (Ans)<\/strong><\/li><li>Each container has its own extracted, isolated copy of the filesystem from an image.<\/li><li>Images are extracted into a readonly directory that can be shared between containers.<\/li><\/ul>\n\n\n\n<p><strong>What is the net effect of a separate mount namespace? Each process can have an entirely separate <em>__<\/em> .<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>ipc<\/li><li>network stack<\/li><li><strong>filesystem (Ans)<\/strong><\/li><li>hostname<\/li><\/ul>\n\n\n\n<p><strong>Virtual Memory is similar to which of the following?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Capabilities<\/li><li>AppArmor<\/li><li>SELinux<\/li><li><strong>Namespaces (Ans)<\/strong><\/li><li>Control Groups<\/li><\/ul>\n\n\n\n<p><strong>Why is networking a concern with containers?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Because container networking is a new frontier and is different than how you network VMs and physical machines<\/li><li>Because you have to use port forwarding to share the host&#8217;s physical network adapter<\/li><li>Because you don&#8217;t want applications to have port conflicts<\/li><li><strong>Because each container usually has its own network namespace that needs configuring (Ans)<\/strong><\/li><li>All of these<\/li><\/ul>\n\n\n\n<p><strong>What can you use to create persistent storage in a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Volume (Ans)<\/strong><\/li><li>Share the container host&#8217;s (root) mount namespace<\/li><li>Root file system<\/li><li>Image layers<\/li><\/ul>\n\n\n\n<p><strong>What is one reason for a top Container Layer added to the underlying image layers when creating the filesystem for a container?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Easily provide a filesystem for containers from a pre-built image extracted into the top container layer<\/li><li><strong>Easily create a new image by snapshotting the top container layer (Ans)<\/strong><\/li><li>Easily configure the networking stack for a container via the top container layer<\/li><\/ul>\n\n\n\n<p><strong>What is a host or container host?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>A process running in the root namespaces on a system (Ans)<\/strong><\/li><li>A process running in a namespace labeled &#8220;host&#8221;<\/li><li>A process running outside of all namespaces<\/li><\/ul>\n\n\n\n<p><strong>Why do you use mount namespaces?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>To isolate networking and avoid issues with port conflicts<\/li><li>To isolate hostnames to make it appear as if a process is running on a separate machine<\/li><li>To isolate the list of processes with which a process can interact<\/li><li><strong>To isolate the filesystem and only provide files that a single application needs (Ans)<\/strong><\/li><\/ul>\n\n\n\n<p><strong>What cluster component helps you find the IP address of another application?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Service Discovery (Ans)<\/strong><\/li><li>Provisioner<\/li><li>Scheduler<\/li><li>Persistent Storage<\/li><\/ul>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_94381\"><iframe loading=\"lazy\"  id=\"_ytid_93362\"  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_94381\"  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>If you want to perform maintenance on a node, to what availability should you change it? Ready Down Drain (Ans) Pause Active Assuming you have a stack called APIS, what&#8230; <\/p>\n","protected":false},"author":1,"featured_media":10441,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4862],"tags":[567],"class_list":["post-9034","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\/9034","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=9034"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9034\/revisions"}],"predecessor-version":[{"id":25050,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9034\/revisions\/25050"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/10441"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=9034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=9034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=9034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}