{"id":1222,"date":"2021-07-12T07:11:00","date_gmt":"2021-07-12T10:11:00","guid":{"rendered":"https:\/\/www.erudio.com.br\/blog\/?p=1222"},"modified":"2021-07-06T10:03:30","modified_gmt":"2021-07-06T13:03:30","slug":"instalando-o-docker-compose-no-linux","status":"publish","type":"post","link":"https:\/\/www.erudio.com.br\/blog\/instalando-o-docker-compose-no-linux\/","title":{"rendered":"Instalando o Docker Compose no Linux"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>Fala pessoal beleza!<br>Nesse post aprenderemos a <em><strong>instalar o<\/strong> <\/em><strong>Docker Compose no Linux<\/strong>. Aprenderemos a fazer isso tanto no <strong>Ubuntu<\/strong> quanto no <strong>CentOS<\/strong>. Se por acaso voc\u00ea estiver usando outra distribui\u00e7\u00e3o <strong><a href=\"https:\/\/docs.docker.com\/compose\/install\/\">acesse o guia oficial<\/a><\/strong> e veja as diferen\u00e7as na sua distribui\u00e7\u00e3o. J\u00e1 se voc\u00ea usa <strong>Windows<\/strong> ao Instalar o <strong>Docker Desktop<\/strong> o <strong>Docker Compose<\/strong> j\u00e1 vem junto e pronto pra uso.<\/p>\n<h4>&nbsp;<\/h4>\n<h4><strong>Instalando o Docker Compose no Ubuntu<\/strong><\/h4>\n<p>&nbsp;<\/p>\n<p>Vamos come\u00e7ar pelo <strong>Ubuntu, <\/strong>pra isso voc\u00ea precisa estar autenticado como <strong>super usu\u00e1rio<\/strong> ou prefixar o comando com <strong>sudo<\/strong>. No primeiro comando faremos o download e em seguida copiaremos o conte\u00fado para o diret\u00f3rio <strong>\/usr\/local\/bin\/docker-compose<\/strong>.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo curl -L &quot;https:\/\/github.com\/docker\/compose\/releases\/download\/1.25.0\/docker-compose-$(uname -s)-$(uname -m)&quot; -o \/usr\/local\/bin\/docker-compose <\/pre>\n<p>Agora que o download foi feito e os arquivos movidos para o diret\u00f3rio correto n\u00f3s precisamos apenas <strong>conceder a permiss\u00e3o de execu\u00e7\u00e3o<\/strong> atrav\u00e9s do comando abaixo:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo chmod +x \/usr\/local\/bin\/docker-compose <\/pre>\n<h4>Conferindo se o <strong>Docker Compose<\/strong> foi instalado Corretamente e est\u00e1 Funcionando<\/h4>\n<p>&nbsp;<\/p>\n<p>Com isso a instala\u00e7\u00e3o foi conclu\u00edda e precisamos apenas conferir se est\u00e1 tudo funcionando atrav\u00e9s do comando:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">docker-compose -v <\/pre>\n<p>Se voc\u00ea ver algo semelhante a tela abaixo significa que est\u00e1 tudo OK caso contr\u00e1rio fez alguma parte do processo de forma incorreta.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nroot@leandro:\/home\/leandro# docker-compose -v\ndocker-compose version 1.29.1, build c34c88b2\n<\/pre>\n<h4>Instalando o Docker Compose no CentOS<\/h4>\n<p>&nbsp;<\/p>\n<p>No <strong>CentOS<\/strong> os comandos s\u00e3o ligeiramente diferentes e se voc\u00ea seguir a documenta\u00e7\u00e3o oficial ter\u00e1 um problema bem explicado <strong><a href=\"https:\/\/stackoverflow.com\/questions\/36685980\/docker-is-installed-but-docker-compose-is-not-why\">nessa thread do Stackoverflow<\/a><\/strong>. O processo \u00e9 o mesmo usamos o <a href=\"https:\/\/curl.se\/\"><strong>CURL<\/strong><\/a> para fazer o download dos pacotes e depois movemos o conteudo para <strong>\/usr\/local\/bin\/docker-compose<\/strong>. Ent\u00e3o basta digitar (ou melhor copiar) o comando:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo curl -L &quot;https:\/\/github.com\/docker\/compose\/releases\/download\/1.25.0\/docker-compose-$(uname -s)-$(uname -m)&quot; -o \/usr\/local\/bin\/docker-compose <\/pre>\n<p>Depois de fazermos o download executaremos um passo extra movendo o<strong> Docker Compose<\/strong> para o diret\u00f3rio <strong>\/usr\/bin\/docker-compose<\/strong>.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo mv \/usr\/local\/bin\/docker-compose \/usr\/bin\/docker-compose <\/pre>\n<p>E fechando basta concedermos permiss\u00e3o de execu\u00e7\u00e3o no diret\u00f3rio onde est\u00e1 o <strong>Docker Compose<\/strong>.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo chmod +x \/usr\/bin\/docker-compose <\/pre>\n<p>Feito isto \u00e9 s\u00f3 testar pra conferir se o <strong>Docker Compose<\/strong> foi instalado e est\u00e1 executando corretamente o processo <em><strong>\u00e9 exatamente igual ao do <\/strong><\/em><strong>Ubuntu<\/strong>.<br>Por esse post \u00e9 isso e <strong><em>se voc\u00ea quer se tornar<\/em><\/strong> um verdadeiro <em><strong>ninja Docker<\/strong><\/em> e conhecer mais sobre <strong>Docker<\/strong> e <strong>Docker Compose<\/strong> eu recomendo <a href=\"https:\/\/pub.erudio.com.br\/guia-docker\"><strong><em>baixar o meu e-Book gratuito<\/em><\/strong> <strong>Docker um guia R\u00e1pido<\/strong><\/a> e dar uma conferida numa playlist sobre o tema <strong><a href=\"https:\/\/www.youtube.com\/c\/ErudioTraining\/videos\">no meu canal no Youtube<\/a><\/strong>.<\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/guia-docker\" target=\"_blank\" rel=\"noopener\"><br><img decoding=\"async\" src=\"https:\/\/www.erudio.com.br\/blog\/wp-content\/uploads\/2021\/06\/banner_inscricao_model3.png\" alt=\"Baixe o Guia Docker gr\u00e1tis\"><br><\/a><\/p>\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Docker para Iniciantes: Minicurso Gratuito Completo!\" width=\"648\" height=\"365\" src=\"https:\/\/www.youtube.com\/embed\/videoseries?list=PL18bbNo7xuh84zAeNjNejyzd1GASt8Q9x\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><figcaption><br>Bom por esse post \u00e9 isso a gente se v\u00ea no pr\u00f3ximo post!!!<\/figcaption><\/figure>\n\n<h2>Treinamentos relacionados com este post<\/h2>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_docker\" target=\"_blank\" rel=\"noopener\">\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Docker do 0 \u00e0 Maestria: Cont\u00eaineres Desmistificados mais 3 B\u00d4NUS\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/09-docker.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_docker_para_aws\" target=\"_blank\" rel=\"noopener\">\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Docker para Amazon AWS Implante Apps Java e .NET com Travis CI\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/10-docker-to-aws.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_spring_java\" target=\"_blank\" rel=\"noopener\">\n        <br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0  AWS com Spring Boot 3, Java e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/07-rest-spring-java.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_asp_net\" target=\"_blank\" rel=\"noopener\">\n        <br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0 Azure com ASP.NET Core 5 e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/01-rest-asp.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_spring_kotlin\" target=\"_blank\" rel=\"noopener\">\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0 AWS com Spring Boot 3, Kotlin e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/18-rest-spring-kotlin.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_microservices_java\" target=\"_blank\" rel=\"noopener\">\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Microservices do 0 com Spring Cloud, Spring Boot e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/14-microservices-java.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_microservices-dotnet\" target=\"_blank\" rel=\"noopener\">\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Arquitetura de Microsservi\u00e7os do 0 com ASP.NET, .NET 6 e C#\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/15-microservices-dotnet.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_ms_kotlin\" target=\"_blank\" rel=\"noopener\">\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Microsservi\u00e7os do 0 com Spring Cloud, Kotlin e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/22-ms-kotlin.png\" \/><br \/>\n    <\/a>\n<\/p>\n<p>\n    <a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_kotlin\" target=\"_blank\" rel=\"noopener\">\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Kotlin para DEVs Java: Aprenda a Linguagem Padr\u00e3o do Android\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/20-kotlin.png\" \/><br \/>\n    <\/a>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Fala pessoal beleza!Nesse post aprenderemos a instalar o Docker Compose no Linux. Aprenderemos a fazer isso tanto no Ubuntu quanto no CentOS. Se por acaso voc\u00ea estiver usando outra distribui\u00e7\u00e3o acesse o guia oficial e veja as diferen\u00e7as na sua distribui\u00e7\u00e3o. J\u00e1 se voc\u00ea usa Windows ao Instalar o Docker Desktop o Docker Compose [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1233,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[261,27,260,262],"tags":[265,151,263,264],"_links":{"self":[{"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/posts\/1222"}],"collection":[{"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/comments?post=1222"}],"version-history":[{"count":41,"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/posts\/1222\/revisions"}],"predecessor-version":[{"id":1384,"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/posts\/1222\/revisions\/1384"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/media\/1233"}],"wp:attachment":[{"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/media?parent=1222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/categories?post=1222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.erudio.com.br\/blog\/wp-json\/wp\/v2\/tags?post=1222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}