{"id":282671,"date":"2021-06-24T14:22:42","date_gmt":"2021-06-24T11:22:42","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/whats-new-in-docker-compose-v2-cloudsavvy-it\/"},"modified":"2021-06-24T14:22:42","modified_gmt":"2021-06-24T11:22:42","slug":"whats-new-in-docker-compose-v2-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/whats-new-in-docker-compose-v2-cloudsavvy-it\/","title":{"rendered":"#What\u2019s New In Docker Compose v2? \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a3dcb94b885b\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a3dcb94b885b\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-new-in-docker-compose-v2-cloudsavvy-it\/#The_New_%E2%80%9Cdocker_compose%E2%80%9D_Command\" >The New \u201cdocker compose\u201d Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-new-in-docker-compose-v2-cloudsavvy-it\/#Experimenting_With_Docker_Compose_v2\" >Experimenting With Docker Compose v2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-new-in-docker-compose-v2-cloudsavvy-it\/#Specification_Changes\" >Specification Changes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-new-in-docker-compose-v2-cloudsavvy-it\/#New_Features_In_v2\" >New Features In v2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-new-in-docker-compose-v2-cloudsavvy-it\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#What\u2019s New In Docker Compose v2? \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage aligncenter size-full wp-image-11186\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/38a27d3e.jpeg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Blue Docker logo on a purple background\" width=\"1602\" height=\"902\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Docker Compose is an immensely popular tool for working with containers. Whereas the ordinary <code>docker<\/code> CLI interacts with one container at a time, <code>docker-compose<\/code> lets you control multiple containers in aggregate.<\/p>\n<p>Compose currently exists as a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/docker\/compose\">standalone project<\/a> that\u2019s distributed independently of Docker. If you want to use Compose, you\u2019ll need to <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">download<\/a> it separately. Many users end up grabbing the binary directly, as OS package managers often lag behind, even if they offer the latest Docker version.<\/p>\n<p>Docker Compose v2 was announced <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.docker.com\/blog\/dockercon-live-2021-looking-back-at-the-new-stuff\">at DockerCon 2021<\/a>. It promises big changes to the Compose experience by integrating it into the <code>docker<\/code> CLI. v2 also comes with new convenience features to help you manage your container stacks.<\/p>\n<h2 id=\"the-new-docker-compose-command\"><span class=\"ez-toc-section\" id=\"The_New_%E2%80%9Cdocker_compose%E2%80%9D_Command\"><\/span>The New \u201cdocker compose\u201d Command<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Docker Compose v2 brings Compose functionality into Docker itself. You\u2019ll be able to use Compose wherever the latest Docker CLI is installed, no extra steps required. Underneath, Docker continues to use the features provided by the Compose project.<\/p>\n<p>Existing <code>docker-compose<\/code> commands should map directly to their new <code>docker compose<\/code> counterparts. In most cases, you can drop the dash with no further changes required. <code>docker compose<\/code> supports almost all the Compose v1 sub-commands and flags, although a minority <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/compose\/cli-command-compatibility\/\">will not be implemented<\/a>.<\/p>\n<p>Compose v2 will still support invocation via the <code>docker-compose<\/code> binary. Existing workflow scripts should keep working, even if you don\u2019t im<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/social-mediaa\/\" data-internallinksmanager029f6b8e52c=\"1\" title=\"Social Media\" target=\"_blank\" rel=\"noopener\">media<\/a>tely update them to use <code>docker compose<\/code>. In the long-term, it\u2019s likely that most authors will switch over to the new form instead.<\/p>\n<h2 id=\"experimenting-with-docker-compose-v2\"><span class=\"ez-toc-section\" id=\"Experimenting_With_Docker_Compose_v2\"><\/span>Experimenting With Docker Compose v2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Compose v2 is currently in beta. Although it remains in development, the new binary is already shipping with Docker Desktop for Windows and Mac. Desktop v3.4 added support for the <code>docker compose<\/code> commands, so chances are you can already use it today. The Linux packages will be updated <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.docker.com\/blog\/dockercon-live-2021-looking-back-at-the-new-stuff\">later in the year<\/a>; a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/compose\/cli-command\/\">manual installation script<\/a> is available in the meantime.<\/p>\n<p>The <code>docker-compose<\/code> command may currently invoke v1 or v2, defaulting to v1. The option is <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/compose\/cli-command\">being automatically turned on<\/a> for a subset of users; it will eventually launch v2 for all.<\/p>\n<p>You can manually switch <code>docker-compose<\/code> between v1 and v2 by running <code>docker-compose disable-v2<\/code> or <code>docker-compose enable-v2<\/code>. This lets you maintain compatibility with any existing Compose files which don\u2019t work with v2. <code>docker compose<\/code> commands will always use v2.<\/p>\n<h2 id=\"specification-changes\"><span class=\"ez-toc-section\" id=\"Specification_Changes\"><\/span>Specification Changes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Bringing Compose functionality to the Docker CLI has necessitated changes to the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/compose-spec\/compose-spec\">Compose spec<\/a>. This now distinguishes between command implementations and the <code>docker-compose.yml<\/code> YAML format.<\/p>\n<p>The revised approach provides new opportunities to integrate additional features. Experimental implementations can be provided more quickly and the Compose team is better equipped to add community proposals. The CLI is more decoupled from the YAML file format, so alternative implementations (like <code>docker compose<\/code>) are a possibility.<\/p>\n<p>Beyond the CLI, the existence of the Composer spec allows cloud providers to implement Compose functionality too. You can now run <code>docker compose up<\/code> against a cloud-based <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/compose\/cli-command\">Docker context<\/a> to launch your app in production. Docker comes with built-in support for <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/cloud\/ecs-integration\">Amazon ECS<\/a> and <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/cloud\/aci-integration\">Microsoft ACI<\/a> environments.<\/p>\n<p>Internally, Compose v2 uses Buildkit by default for faster builds. Overall performance <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/docker\/compose-cli#compose-v2-aka-local-docker-compose\">should be quicker<\/a> as more tasks run in parallel, reducing processing times.<\/p>\n<h2 id=\"new-features-in-v2\"><span class=\"ez-toc-section\" id=\"New_Features_In_v2\"><\/span>New Features In v2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The switch from <code>docker-compose<\/code> to <code>docker compose<\/code> isn\u2019t the only change in v2. There are also new features that affect how you interact with your container stacks.<\/p>\n<p>One limitation of Compose v1 is its approach to project names. When you run <code>docker-compose up -d<\/code>, Compose prepends the project name to each container\u2019s service name. This ensures all the containers are grouped together.<\/p>\n<p>v1 infers the project name from the name of your working directory. You can manually choose a different name by setting the <code>COMPOSE_PROJECT_NAME<\/code> environment variable.<\/p>\n<p>v2 simplifies this by adding a CLI flag to set the project name. Add <code>--project-name<\/code> or <code>-p<\/code> to ignore the working directory\u2019s name, without altering the environment. Manually setting the project name lets you combine containers from multiple working directories into one stack, or start multiple instances of a container stack.<\/p>\n<p>Another new v2 feature lets you list all Compose stacks on your system. The <code>docker compose ls<\/code> command provides a table of project names and their status (running or stopped). This complements the <code>docker compose ps<\/code> command which gives the statuses of containers in a stack.<\/p>\n<p>Compose v2 also adds support for <code>docker compose cp<\/code>. This command works similarly to <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/cp\"><code>docker cp<\/code><\/a> and lets you copy files in and out of your containers:<\/p>\n<pre>docker cp my-container local-file.txt \/path\/to\/container\/file.txt<\/pre>\n<h2 id=\"summary\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Docker Compose v2 is a substantial upgrade that brings improved convenience to the container management tool. Integrating Compose into the main Docker CLI means it\u2019s available wherever Docker is. This makes it more accessible and easier to get started with.<\/p>\n<p>Compose v2 also brings some extra utility commands to make it easier to work with different stacks and containers. You get improved visibility into what\u2019s running on your system. While it\u2019s still in beta at the time of writing, Windows and Mac users can use v2 today, while Linux users can <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/compose\/cli-command\">download the latest build<\/a> from GitHub.\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/12144\/whats-new-in-docker-compose-v2\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#What\u2019s New In Docker Compose v2? \u2013 CloudSavvy IT&#8221; Docker Compose is an immensely popular tool for working with containers. Whereas the ordinary docker CLI interacts with one container at a time, docker-compose lets you control multiple containers in aggregate. Compose currently exists as a standalone project that\u2019s distributed independently of Docker. If you want&#8230;<\/p>\n","protected":false},"author":1,"featured_media":282672,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/05\/38a27d3e.jpeg","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-282671","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/282671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=282671"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/282671\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/282672"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=282671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=282671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=282671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}