{"id":1259,"date":"2017-03-24T08:40:35","date_gmt":"2017-03-24T03:10:35","guid":{"rendered":"https:\/\/blog.pheonixsolutions.com\/?p=1259"},"modified":"2017-03-24T08:46:39","modified_gmt":"2017-03-24T03:16:39","slug":"overview-of-docker","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/","title":{"rendered":"Overview of Docker|Docker Commands"},"content":{"rendered":"<p><strong>Date Posted: 17-03-2017<\/strong><\/p>\n<p>Docker is a most handy devops tool used nowdays. In this post, we explains few things about docker starts from installation. We tested docker on ubuntu machine. The docker command whatever we deals in the post will be same all linux flavors. Installation and few other command may differ based of base OS.<\/p>\n<h4>Implementation:<\/h4>\n<h5>Installation:<\/h5>\n<p>We install docker on the ubuntu host. First, we will install the dependencies.<\/p>\n<p><code>sudo apt-get install -y --no-install-recommends \\<br \/>\napt-transport-https \\<br \/>\nca-certificates \\<br \/>\ncurl \\<br \/>\nsoftware-properties-common<\/code><\/p>\n<p>Add the docker key \u00a0to the server.<\/p>\n<p><code>curl -fsSL https:\/\/apt.dockerproject.org\/gpg | sudo apt-key add -<\/code><\/p>\n<p>Add the docker repo to the server.<\/p>\n<p><code>add-apt-repository \\<br \/>\n\"deb https:\/\/apt.dockerproject.org\/repo\/ \\<br \/>\nubuntu-$(lsb_release -cs) \\<br \/>\nmain\"<\/code><\/p>\n<p>Perform the repo update.<\/p>\n<p><code>apt-get update<\/code><\/p>\n<p>Install the docker-engine.<\/p>\n<p><code>apt-get -y install docker-engine<\/code><\/p>\n<h4>Basic Directory Structure of Docker:<\/h4>\n<p><em>\/var\/lib\/docker<\/em> &#8211; Base Directory<br \/>\n<em>\/var\/lib\/docker\/container<\/em> &#8211; Container information<br \/>\n<em>\/var\/lib\/docker\/container\/container-longname\/hostconfig.json<\/em> &#8211; Has full details about host information<br \/>\n<em>\/var\/lib\/docker\/volumes\/uniquevolumeID\/_data<\/em> &#8211; volume which created inside the docker container. This is called persistent data creation<\/p>\n<h5>Working on Docker:<\/h5>\n<p>Here comes the first command on docker \ud83d\ude42 The below command download the hello-world docker image from docker repo.<\/p>\n<p><code>docker run hello-world<\/code><\/p>\n<p>To download ubuntu image with terminal prompt, use the below command.<\/p>\n<p><code>docker run -it ubuntu bash<\/code><\/p>\n<p>To view the available images on your images.<\/p>\n<p><code>docker images<\/code><\/p>\n<p>To tag a image use the following command.<\/p>\n<p><code>docker tag 73fd91f23a84 pheonixsolutions\/docker-whale:latest<\/code><\/p>\n<p>where <span style=\"color: #000000;\"><code>73fd91f23a84\u00a0<\/code>is a image name<\/span><\/p>\n<p>Create an account on\u00a0hub.docker.com where you can store your images on docker hub.<\/p>\n<p>To login to docker hub, use the following command.<\/p>\n<p><code>docker login<\/code><\/p>\n<p>Inorder to push the image to docker hub. The below command will push the docker image\u00a0<em>docker-whale(<\/em>previously tagged image) to docker hub<\/p>\n<p><code>docker push pheonixsolutions\/docker-whale<\/code><\/p>\n<p>To pull image from github account,<\/p>\n<p><code>docker run pheonixsolutions\/docker-whale<\/code><\/p>\n<p>To\u00a0login to the docker container<\/p>\n<p><code>docker run -ti ubuntu:14.04 \/bin\/bash<\/code><\/p>\n<p>Presss<em> Ctrl + P + Q<\/em> &#8211; to exit from container without stop.<\/p>\n<p>To view the existing container<\/p>\n<p><code>docker ps<\/code><\/p>\n<p>To Connect to Docker container using container ID<\/p>\n<p><code>docker attach c26fe223abeb<\/code><\/p>\n<p>where,\u00a0c26fe223abeb is a container ID<\/p>\n<p>To\u00a0show inact container as well.<\/p>\n<p><code>docker ps -a<\/code><\/p>\n<p>To start any inact container,<\/p>\n<p><code>docker start\u00a0196b121e371b<\/code><\/p>\n<p>where\u00a0196b121e371b is the container ID.<\/p>\n<p>To Stop the running container.<\/p>\n<p><code>docker stop\u00a0196b121e371b<\/code><\/p>\n<p>where\u00a0196b121e371b is the container ID.<\/p>\n<p>To name the container and detach container after the launch.<\/p>\n<p><code>docker run -d -ti --name=pheonixcontainer ubuntu:14.04 \/bin\/bash<\/code><\/p>\n<p>where d stands for detach the container,<\/p>\n<p>name used to represent the name of the container.<\/p>\n<p>To map the base OS volume to the docker container. The below example mounts the base OS volume to \/data directory on the container<\/p>\n<p><code>docker run -ti -v \/data --name=pheonixvolume \u00a0ubuntu:14.04<\/code><\/p>\n<p>where v represents the docker container mount point.<\/p>\n<p>To mount different base OS partition. The below example mounts\u00a0<em>\/home\/pheonixsolutions\u00a0<\/em>to \/data on the container.<\/p>\n<p><code>docker run -ti -v \/home\/pheonixsolutions:\/data --name=pheonixvolume \u00a0ubuntu:14.04<\/code><\/p>\n<p>To bind a port to a container,<\/p>\n<p><code>docker run -d -p 3306 -ti \u00a0--name=mysql1 mysql \/bin\/bash<\/code><\/p>\n<p>where p denotes the port number<\/p>\n<p>To forward a port request from base OS to docker container.<\/p>\n<p><code>docker run -d -p 80:80 -ti --name=mysql2 mysql \/bin\/bash<\/code><\/p>\n<p>where 80:80 forwards port 80 request from base OS to docker container.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Date Posted: 17-03-2017 Docker is a most handy devops tool used nowdays. In this post, we explains few things about docker starts from installation. We tested docker on ubuntu machine. The docker command whatever we deals in the post will be same all linux flavors. Installation and few other command&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">Overview of Docker|Docker Commands<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[303,306],"tags":[305,304],"class_list":{"0":"post-1259","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-devops","7":"category-docker","8":"tag-devops","9":"tag-docker","10":"h-entry","12":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"Date Posted: 17-03-2017 Docker is a most handy devops tool used nowdays. In this post, we explains few things about docker starts from installation. We tested docker on ubuntu machine. The docker command whatever we deals in the post will be same all linux flavors. Installation and few other command&hellip; Continue Reading Overview of Docker|Docker Commands\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-24T03:10:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-03-24T03:16:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3837\" \/>\n\t<meta property=\"og:image:height\" content=\"2540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\"},\"headline\":\"Overview of Docker|Docker Commands\",\"datePublished\":\"2017-03-24T03:10:35+00:00\",\"dateModified\":\"2017-03-24T03:16:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/\"},\"wordCount\":436,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"keywords\":[\"devops\",\"docker\"],\"articleSection\":[\"Devops\",\"Docker\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2017-03-24T03:10:35+00:00\",\"dateModified\":\"2017-03-24T03:16:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/overview-of-docker\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Overview of Docker|Docker Commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\\\/\\\/blog.pheonixsolutions.com\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"Date Posted: 17-03-2017 Docker is a most handy devops tool used nowdays. In this post, we explains few things about docker starts from installation. We tested docker on ubuntu machine. The docker command whatever we deals in the post will be same all linux flavors. Installation and few other command&hellip; Continue Reading Overview of Docker|Docker Commands","og_url":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2017-03-24T03:10:35+00:00","article_modified_time":"2017-03-24T03:16:39+00:00","og_image":[{"width":3837,"height":2540,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/"},"author":{"name":"admin","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503"},"headline":"Overview of Docker|Docker Commands","datePublished":"2017-03-24T03:10:35+00:00","dateModified":"2017-03-24T03:16:39+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/"},"wordCount":436,"commentCount":2,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"keywords":["devops","docker"],"articleSection":["Devops","Docker"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/","url":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"datePublished":"2017-03-24T03:10:35+00:00","dateModified":"2017-03-24T03:16:39+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/overview-of-docker\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Overview of Docker|Docker Commands"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","caption":"admin"},"sameAs":["http:\/\/blog.pheonixsolutions.com"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/admin\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-kj","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1259"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1259\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}