{"id":9419,"date":"2022-05-12T15:13:02","date_gmt":"2022-05-12T09:43:02","guid":{"rendered":"https:\/\/www.skynats.com\/?p=9419"},"modified":"2024-02-21T19:12:22","modified_gmt":"2024-02-21T13:42:22","slug":"aws-opsworks-docker-an-overview","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/","title":{"rendered":"AWS OpsWorks Docker | An Overview"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is AWS OpsWorks Docker?<\/h2>\n\n\n\n<p>AWS OpsWorks enables us to deploy and manage various applications. We can also create instances for EC2 instances to install and configure any software we need. We can use templates or create our own by using Chef recipes.<\/p>\n\n\n\n<p>These templates enable us to install software packages and carry out any scripted task. AWS OpsWorks can also scale our application using application load-based or time-based scaling. It also keeps the application healthy by monitoring for failed instances and replacing them as needed.<\/p>\n\n\n\n<p>Here are a few benefits of using Docker on AWS OpsWorks.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>AWS resource automation<\/li><li>Docker version and installation are completely under your control.<\/li><li>Resource discovery<\/li><li>Complete control over container-to-instance mapping<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-run-docker-on-aws-opsworks\">How to run Docker on AWS OpsWorks?<\/h2>\n\n\n\n<p>The steps involved in the AWS OpsWorks Docker process:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Make recipes<\/li><li>Make an OpsWorks Stack.<\/li><li>Create a layer<\/li><li>Include an instance<\/li><li>Add an app and then deploy it.<\/li><li>Create attributes dynamic<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-make-recipes-on-aws-opsworks\">How to Make Recipes on AWS OpsWorks?<\/h3>\n\n\n\n<p>To begin, make a repository to keep the Chef recipes. The following docker:: The install recipe installs the necessary Docker software on AWS OpsWorks :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>case node&#91;:platform]\nwhen \"ubuntu\",\"debian\"\n  package \"docker.io\" do\n    action :install\n  end\nwhen 'centos','redhat','fedora','amazon'\n  package \"docker\" do\n    action :install\n  end\nend\n\nservice \"docker\" do\n  action :start\nend<\/code><\/pre>\n\n\n\n<p>Furthermore, the docker::docker-deploy recipe below deploys the docker containers on AWS OpsWorks:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>include_recipe 'deploy'\n\nnode&#91;:deploy].each do |application, deploy|\n  \n  if node&#91;:opsworks]&#91;:instance]&#91;:layers].first != deploy&#91;:environment_variables]&#91;:layer]\n    Chef::Log.debug(\"Skipping deploy::docker application #{application} as it is not deployed to this layer\")\n    next\n  end\n\n  opsworks_deploy_dir do\n    user deploy&#91;:user]\n    group deploy&#91;:group]\n    path deploy&#91;:deploy_to]\n  end\n\n  opsworks_deploy do\n    deploy_data deploy\n    app application\n  end\n\n  bash \"docker-cleanup\" do\n    user \"root\"\n    code &lt;&lt;-EOH\n      if docker ps | grep #{deploy&#91;:application]}; \n      then\n        docker stop #{deploy&#91;:application]}\n        sleep 3\n        docker rm #{deploy&#91;:application]}\n        sleep 3\n      fi\n      if docker images | grep #{deploy&#91;:application]}; \n      then\n        docker rmi #{deploy&#91;:application]}\n      fi\n    EOH\n  end\n\n  bash \"docker-build\" do\n    user \"root\"\n    cwd \"#{deploy&#91;:deploy_to]}\/current\"\n    code &lt;&lt;-EOH\n     docker build -t=#{deploy&#91;:application]} . &gt; #{deploy&#91;:application]}-docker.out\n    EOH\n  end\n  \n  dockerenvs = \" \"\n  deploy&#91;:environment_variables].each do |key, value|\n    dockerenvs=dockerenvs+\" -e \"+key+\"=\"+value\n  end\n  \n  bash \"docker-run\" do\n    user \"root\"\n    cwd \"#{deploy&#91;:deploy_to]}\/current\"\n    code &lt;&lt;-EOH\n      docker run #{dockerenvs} -p #{node&#91;:opsworks]&#91;:instance]&#91;:private_ip]}:#{deploy&#91;:environment_variables]&#91;:service_port]}:#{deploy&#91;:environment_variables]&#91;:container_port]} --name #{deploy&#91;:application]} -d #{deploy&#91;:application]}\n    EOH\n  end\n\nend<\/code><\/pre>\n\n\n\n<p>Following that, we must create a repository to store the Dockerfile.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-how-to-create-an-opsworks-stack\">How to Create an OpsWorks Stack?<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>To begin, launch the AWS OpsWorks console.<\/li><li>After that, choose Add a Stack and Advanced.<\/li><li>Set the Use custom Chef Cookbooks option to Yes and the Repository type to Git.<\/li><li>Afterward, set the Repository URL to the repository where we saved the recipes from the previous step.<\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-how-to-create-a-layer\">How to Create a Layer?<\/h4>\n\n\n\n<ol class=\"wp-block-list\"><li>Select Add Layer from the AWS OpsWorks console.<\/li><li>Then, select Custom Layer, enter &#8220;Docker&#8221; as the name and &#8220;docker&#8221; as the shortname, and click Add Layer.<\/li><li>Next, go to the Custom Chef recipes section by selecting the layer&#8217;s Edit Recipes action.<\/li><li>Then, in the Setup box, type docker::install and in the Deploy box, docker::docker-deploy, and click +.<\/li><li>Finally, click the Save button to finish.<\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-how-to-include-an-instance\">How to Include an Instance?<\/h4>\n\n\n\n<p>At this point, the Layer page on AWS OpsWorks will show the Docker layer. We must now add instances to the layer by choosing Instances from the Docker layer and clicking the + button. Accept the default settings and then click the Add Instance button. To begin the instance, we must choose Start from the row&#8217;s actions column. This starts a new EC2 instance and also executes the Setup recipes to configure Docker.<\/p>\n\n\n\n<p>After launching the instance, we must add an app and deploy it. This is accomplished through the AWS OpsWorks console. We will be able to see the app after it has been deployed by clicking the server&#8217;s public IP address. To finish the process, we must update AWS OpsWorks attributes.<\/p>\n\n\n\n<p>If you need assistance setting up AWS OpsWorks Docker, our <a href=\"https:\/\/www.skynats.com\/aws-management\/\" target=\"_blank\" rel=\"noreferrer noopener\">AWS Support<\/a> Teams are available to assist you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is AWS OpsWorks Docker? AWS OpsWorks enables us to deploy and manage various applications. We can also create instances for EC2 instances to install and configure any software we need. We can use templates or create our own by using Chef recipes. These templates enable us to install software packages and carry out any [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[142,5],"tags":[696],"class_list":["post-9419","post","type-post","status-publish","format-standard","hentry","category-aws-management","category-blog","tag-aws-opsworks-docker"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>AWS OpsWorks Docker | An Overview<\/title>\n<meta name=\"description\" content=\"Learn how to: Run Docker on AWS OpsWorks? Making Recipes on AWS OpsWorks? Creating an OpsWorks Stack? Creating a Layer? and more\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AWS OpsWorks Docker | An Overview\" \/>\n<meta property=\"og:description\" content=\"Learn how to: Run Docker on AWS OpsWorks? Making Recipes on AWS OpsWorks? Creating an OpsWorks Stack? Creating a Layer? and more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/\" \/>\n<meta property=\"og:site_name\" content=\"Server Management Services | Cloud Management | Skynats\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/skynats\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-12T09:43:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-21T13:42:22+00:00\" \/>\n<meta name=\"author\" content=\"Kevin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@skynatstech\" \/>\n<meta name=\"twitter:site\" content=\"@skynatstech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kevin\" \/>\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:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/\"},\"author\":{\"name\":\"Kevin\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/person\\\/749ae0470320eb759ff1e07b8ea7fbe3\"},\"headline\":\"AWS OpsWorks Docker | An Overview\",\"datePublished\":\"2022-05-12T09:43:02+00:00\",\"dateModified\":\"2024-02-21T13:42:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/\"},\"wordCount\":485,\"publisher\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\"},\"keywords\":[\"aws opsworks docker\"],\"articleSection\":[\"aws management\",\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/\",\"name\":\"AWS OpsWorks Docker | An Overview\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-05-12T09:43:02+00:00\",\"dateModified\":\"2024-02-21T13:42:22+00:00\",\"description\":\"Learn how to: Run Docker on AWS OpsWorks? Making Recipes on AWS OpsWorks? Creating an OpsWorks Stack? Creating a Layer? and more\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/aws-opsworks-docker-an-overview\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AWS OpsWorks Docker | An Overview\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\",\"name\":\"Server Management Services | Cloud Management | Skynats\",\"description\":\"Server Management and Cloud Management\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\",\"name\":\"Skynats Technologies\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Sknats-Logo-New-whole.png\",\"contentUrl\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Sknats-Logo-New-whole.png\",\"width\":989,\"height\":367,\"caption\":\"Skynats Technologies\"},\"image\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/skynats\",\"https:\\\/\\\/x.com\\\/skynatstech\",\"https:\\\/\\\/www.instagram.com\\\/skynatstech\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/skynats-technologies\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCvTAjrFJ4_E2MJKwlDHomlg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/person\\\/749ae0470320eb759ff1e07b8ea7fbe3\",\"name\":\"Kevin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g\",\"caption\":\"Kevin\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"AWS OpsWorks Docker | An Overview","description":"Learn how to: Run Docker on AWS OpsWorks? Making Recipes on AWS OpsWorks? Creating an OpsWorks Stack? Creating a Layer? and more","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:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/","og_locale":"en_US","og_type":"article","og_title":"AWS OpsWorks Docker | An Overview","og_description":"Learn how to: Run Docker on AWS OpsWorks? Making Recipes on AWS OpsWorks? Creating an OpsWorks Stack? Creating a Layer? and more","og_url":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/","og_site_name":"Server Management Services | Cloud Management | Skynats","article_publisher":"https:\/\/www.facebook.com\/skynats","article_published_time":"2022-05-12T09:43:02+00:00","article_modified_time":"2024-02-21T13:42:22+00:00","author":"Kevin","twitter_card":"summary_large_image","twitter_creator":"@skynatstech","twitter_site":"@skynatstech","twitter_misc":{"Written by":"Kevin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/#article","isPartOf":{"@id":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/"},"author":{"name":"Kevin","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/person\/749ae0470320eb759ff1e07b8ea7fbe3"},"headline":"AWS OpsWorks Docker | An Overview","datePublished":"2022-05-12T09:43:02+00:00","dateModified":"2024-02-21T13:42:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/"},"wordCount":485,"publisher":{"@id":"https:\/\/www.skynats.com\/blog\/#organization"},"keywords":["aws opsworks docker"],"articleSection":["aws management","Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/","url":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/","name":"AWS OpsWorks Docker | An Overview","isPartOf":{"@id":"https:\/\/www.skynats.com\/blog\/#website"},"datePublished":"2022-05-12T09:43:02+00:00","dateModified":"2024-02-21T13:42:22+00:00","description":"Learn how to: Run Docker on AWS OpsWorks? Making Recipes on AWS OpsWorks? Creating an OpsWorks Stack? Creating a Layer? and more","breadcrumb":{"@id":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.skynats.com\/blog\/aws-opsworks-docker-an-overview\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.skynats.com\/blog\/"},{"@type":"ListItem","position":2,"name":"AWS OpsWorks Docker | An Overview"}]},{"@type":"WebSite","@id":"https:\/\/www.skynats.com\/blog\/#website","url":"https:\/\/www.skynats.com\/blog\/","name":"Server Management Services | Cloud Management | Skynats","description":"Server Management and Cloud Management","publisher":{"@id":"https:\/\/www.skynats.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.skynats.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.skynats.com\/blog\/#organization","name":"Skynats Technologies","url":"https:\/\/www.skynats.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/Sknats-Logo-New-whole.png","contentUrl":"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/Sknats-Logo-New-whole.png","width":989,"height":367,"caption":"Skynats Technologies"},"image":{"@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/skynats","https:\/\/x.com\/skynatstech","https:\/\/www.instagram.com\/skynatstech\/","https:\/\/www.linkedin.com\/company\/skynats-technologies","https:\/\/www.youtube.com\/channel\/UCvTAjrFJ4_E2MJKwlDHomlg"]},{"@type":"Person","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/person\/749ae0470320eb759ff1e07b8ea7fbe3","name":"Kevin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/37a006382b218eff478403065cc9d903f85dd0085cb2af7fee95b4537b581c13?s=96&d=mm&r=g","caption":"Kevin"}}]}},"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/9419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=9419"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/9419\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=9419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=9419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=9419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}