{"id":1685,"date":"2022-10-18T11:10:02","date_gmt":"2022-10-18T11:10:02","guid":{"rendered":"https:\/\/blog.amt.in\/?p=1685"},"modified":"2022-10-18T11:10:02","modified_gmt":"2022-10-18T11:10:02","slug":"introduction-to-docker","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2022\/10\/18\/introduction-to-docker\/","title":{"rendered":"Introduction to Docker"},"content":{"rendered":"<p>Docker\u00c2\u00a0is a set of\u00c2\u00a0platform as a service\u00c2\u00a0(PaaS) products that uses\u00c2\u00a0OS-level virtualization\u00c2\u00a0to deliver software in packages called containers.\u00c2\u00a0Containers are isolated from one another and bundle their own software,\u00c2\u00a0libraries\u00c2\u00a0and configuration files; they can communicate with each other through well-defined channels.\u00c2\u00a0All containers are run by a single\u00c2\u00a0operating-system kernel\u00c2\u00a0and are thus more lightweight than\u00c2\u00a0virtual machines.<\/p>\n<p>The service has both free and premium tiers. The software that hosts the containers is called\u00c2\u00a0Docker Engine.\u00c2\u00a0It was first started in 2013 and is developed by\u00c2\u00a0Docker, Inc.<\/p>\n<p>Docker can package an application and its dependencies in a virtual container that can run on any Linux server. This helps provide flexibility and portability enabling the application to be run in various locations, whether\u00c2\u00a0on-premises, in a\u00c2\u00a0public cloud, or in a\u00c2\u00a0private cloud.\u00c2\u00a0Docker uses the resource isolation features of the\u00c2\u00a0Linux kernel\u00c2\u00a0(such as\u00c2\u00a0cgroups\u00c2\u00a0and kernel\u00c2\u00a0namespaces) and a\u00c2\u00a0union-capable file system\u00c2\u00a0(such as\u00c2\u00a0OverlayFS)\u00c2\u00a0to allow containers to run within a single Linux instance, avoiding the overhead of starting and maintaining\u00c2\u00a0virtual machines.\u00c2\u00a0Because Docker containers are lightweight, a single server or\u00c2\u00a0virtual machine\u00c2\u00a0can run several containers simultaneously.\u00c2\u00a0A 2018 analysis found that a typical Docker use case involves running eight containers per host, but that a quarter of analyzed organizations run 18 or more per host.<\/p>\n<p>The Linux kernel&#8217;s support for namespaces mostly\u00c2\u00a0isolates an application&#8217;s view of the operating environment, including process trees, network, user IDs and mounted file systems, while the kernel&#8217;s cgroups provide resource limiting for memory and CPU.\u00c2\u00a0Since version 0.9, Docker includes its own component (called &#8220;<span class=\"monospaced\">libcontainer<\/span>&#8220;) to directly use virtualization facilities provided by the Linux kernel, in addition to using abstracted virtualization interfaces via\u00c2\u00a0libvirt,\u00c2\u00a0LXC\u00c2\u00a0and\u00c2\u00a0systemd-nspawn.<\/p>\n<p>Docker implements a high-level\u00c2\u00a0API\u00c2\u00a0to provide lightweight containers that run processes in isolation.<\/p>\n<p><span id=\"Components\" class=\"mw-headline\">Components:<\/span><\/p>\n<p>The Docker software as a service offering consists of three components:<\/p>\n<ul>\n<li><b>Software:<\/b>\u00c2\u00a0The Docker\u00c2\u00a0daemon, called\u00c2\u00a0<code>dockerd<\/code>, is a persistent process that manages Docker containers and handles container objects. The daemon listens for requests sent via the Docker Engine API.\u00c2\u00a0The Docker client program, called\u00c2\u00a0<code>docker<\/code>, provides a\u00c2\u00a0command-line interface\u00c2\u00a0that allows users to interact with Docker daemons.<\/li>\n<li><b>Objects:<\/b>\u00c2\u00a0Docker objects are various entities used to assemble an application in Docker. The main classes of Docker objects are images, containers, and services.\n<ul>\n<li>A Docker container is a standardized, encapsulated environment that runs applications.\u00c2\u00a0A container is managed using the Docker API or CLI.<\/li>\n<li>A Docker image is a read-only template used to build containers. Images are used to store and ship applications.<\/li>\n<li>A Docker service allows containers to be scaled across multiple Docker daemons. The result is known as a\u00c2\u00a0swarm, a set of cooperating daemons that communicate through the Docker API.<\/li>\n<\/ul>\n<\/li>\n<li><b>Registries:<\/b>\u00c2\u00a0A Docker registry is a repository for Docker images. Docker clients connect to registries to download (&#8220;pull&#8221;) images for use or upload (&#8220;push&#8221;) images that they have built. Registries can be public or private. Two main public registries are Docker Hub and Docker Cloud. Docker Hub is the default registry where Docker looks for images.\u00c2\u00a0Docker registries also allow the creation of notifications based on events.<\/li>\n<\/ul>\n<p><span id=\"Tools\" class=\"mw-headline\">Tools:<\/span><\/p>\n<ul>\n<li><b>Docker Compose<\/b>\u00c2\u00a0is a tool for defining and running multi-container Docker applications.\u00c2\u00a0It uses\u00c2\u00a0YAML\u00c2\u00a0files to configure the application&#8217;s services and performs the creation and start-up process of all the containers with a single command. The\u00c2\u00a0<code>docker-compose<\/code>\u00c2\u00a0CLI utility allows users to run commands on multiple containers at once, for example, building images,\u00c2\u00a0scaling\u00c2\u00a0containers, running containers that were stopped, and more.\u00c2\u00a0Commands related to image manipulation, or user-interactive options, are not relevant in Docker Compose because they address one container.\u00c2\u00a0The\u00c2\u00a0docker-compose.yml\u00c2\u00a0file is used to define an application&#8217;s services and includes various configuration options. For example, the\u00c2\u00a0<code>build<\/code>\u00c2\u00a0option defines configuration options such as the Dockerfile path, the\u00c2\u00a0<code>command<\/code>\u00c2\u00a0option allows one to override default Docker commands, and more.\u00c2\u00a0The first public beta version of Docker Compose (version 0.0.1) was released on December 21, 2013.\u00c2\u00a0The first production-ready version (1.0) was made available on October 16, 2014.<\/li>\n<li><b>Docker Swarm<\/b>\u00c2\u00a0provides native\u00c2\u00a0clustering\u00c2\u00a0functionality for Docker containers, which turns a group of Docker engines into a single virtual Docker engine.\u00c2\u00a0In Docker 1.12 and higher, Swarm mode is integrated with Docker Engine.\u00c2\u00a0The\u00c2\u00a0<code>docker swarm<\/code>\u00c2\u00a0CLI\u00c2\u00a0utility allows users to run Swarm containers, create discovery tokens, list nodes in the cluster, and more.\u00c2\u00a0The\u00c2\u00a0<code>docker node<\/code>\u00c2\u00a0CLI utility allows users to run various commands to manage nodes in a swarm, for example, listing the nodes in a swarm, updating nodes, and removing nodes from the swarm.\u00c2\u00a0Docker manages swarms using the\u00c2\u00a0Raft Consensus Algorithm. According to Raft, for an update to be performed, the majority of Swarm nodes need to agree on the update.<\/li>\n<\/ul>\n<p>The above is a brief about Docker. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker\u00c2\u00a0is a set of\u00c2\u00a0platform as<\/p>\n","protected":false},"author":1,"featured_media":1687,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[569,570,7],"tags":[571,572,18],"class_list":["post-1685","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","category-platform-as-a-service","category-techtrends","tag-docker","tag-platform-as-a-service","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=1685"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1685\/revisions"}],"predecessor-version":[{"id":1686,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1685\/revisions\/1686"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/1687"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=1685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=1685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=1685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}