DevopsLinux

Como instalar Docker e docker-compose no Linux Ubuntu, Mint e Debian

Docker é uma plataforma de código aberto para desenvolvimento, implantação e execução de aplicativos. Para usá-lo em sistemas operacionais, é necessário instalá-lo. Neste texto, veremos como instalar e configurar no Debian Linux: distribuições baseadas em Mint e Ubuntu.

Com o Docker, você pode separar aplicativos da sua infraestrutura, permitindo implantar rapidamente seus softwares em servidores. Ele possibilita gerenciar a infraestrutura da mesma forma que gerencia seus aplicativos. Ao usar as metodologias do Docker para criar, testar e implantar código rapidamente, é possível reduzir significativamente o tempo entre escrever o código e executá-lo em produção.

Instalando Docker no Linux Mint e Ubuntu

Eu explico como instalar o Docker no Linux Mint usando os repositórios oficiais, que é semelhante à instalação em Ubuntu ou sistemas derivados do Debian.

1- Instale os pacotes que permitirão a utilização do repositório por HTTPS:

 sudo apt-get update

 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

2- Adicione chaves GPG oficiais do Docker

sudo mkdir -p /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

3- Configure o repositório, você pode usar o seguinte comando

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

É necessário corrigir o nome da versão do Linux Mint para refletir a versão do Ubuntu no arquivo de origem. Isso é importante porque o Mint é baseado no Ubuntu e o Docker não oferece fonte APT para o Mint. Se você executar um apt update antes da correção, verá o seguinte erro:

The repository 'https://download.docker.com/linux/ubuntu una Release' does not have a Release file.

Digite o seguinte comando para verificar a versão:


sudo cat /etc/upstream-release/lsb-release 
[sudo] password for edcarlos:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu Jammy Jellyfish"

No exemplo anterior, o resultado da versão do meu Linux Mint para o Ubuntu é “jammy”. Agora é preciso alterar esse nome no arquivo de origem do Docker Apt:

sudo nano /etc/apt/sources.list.d/docker.list 

Altere una para jammy na seguinte linha do arquivo:

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable

Agora é só instalar o docker-engine e o docker-compose:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-compose

Vamos testar a instalação:

sudo docker run hello-world

Agora estamos prontos para instalar os pacotes das nossas linguagens, bancos de dados e outras ferramentas em contêineres Docker sem precisar “poluir” a instalação do sistema operacional. Além disso, temos a vantagem de iniciar e parar serviços quando necessário e usar diferentes versões de linguagens de interface ou de programação para cada projeto.

Adicionando a conta de usuário comum ao grupo docker

Um problema comum ao executar o docker-compose, mesmo ao usar o Docker pela primeira vez, é a falta de permissão no arquivo docker.sock:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

Agora você precisa adicionar o usuário que está usando ao grupo que possui permissão para gravar nos arquivos privilegiados do Docker.

sudo usermod -aG docker $USER

Faça log out e log in novamente para a mudança de grupo fazer efeito e rode o comando novamente,tudo deve funcionar :).

31 thoughts on “Como instalar Docker e docker-compose no Linux Ubuntu, Mint e Debian

  • Logged into 777adlogin today. No frills, just gets the job done. If you’re looking for something simple, give it a shot. Find it here 777adlogin

    Resposta
  • Been testing out 789pvip lately, and I’m liking what I see! Great selection of games and the site is super easy to use. Worth a punt, IMO.

    Resposta
  • Signed up for PK68VIP, seemed pretty standard to me. I saw some good bonus offers so far which is nice. You can check it here: pk68vip

    Resposta
  • Gamebet2 is pretty basic, but sometimes that’s what you want. Simple, easy to navigate. Got a few go-to games there now. Give it a try if you are after something straightforward! Link here: gamebet2

    Resposta
  • As someone who’s played every Sprunki iteration, Phase 10000 finally nails the difficulty curve. The new phase-shift mechanic adds strategic depth without being overwhelming. GG to the devs!

    Resposta
  • As someone who’s played all the Sprunki demos, Phase 10’s mechanics feel polished but I noticed a minor glitch in the third level. Anyone else experiencing this? Still, gg to the devs!

    Resposta
  • Just downloaded Sprunki 4.5 and the new music tracks are absolute bangers! The devs really nailed the vibes this time. Can’t wait to see what glitches people find in the new levels.

    Resposta
  • Solaire Online Casino Philippines: Access Solaire Login, Register today, and get the Solaire App Download for the best Solaire Slots experience. Experience the thrill of Solaire Online Casino Philippines! Access your Solaire Login, Register today, and get the Solaire App Download for the best Solaire Slots. visit: solaire

    Resposta
  • 7vvbet, eh? Never tried it before. I’m always looking for new places to play. Hopefully, it’s not a scam! Giving it a shot. Find it here 7vvbet.

    Resposta
  • Downloading the a777gameapk right now. Hope the app is smooth and the games are legit. Fingers crossed for a good experience! Download yours here a777gameapk.

    Resposta
  • [4367]88jili Online Casino Philippines: Fast 88jili Login & Register, Official App Download, and Premium 88jili Slot Games. Experience 88jili Online Casino Philippines! Fast 88jili login & register to play premium 88jili slot games. Get the official 88jili app download & start winning today! visit: 88jili

    Resposta
  • Yo, Diwatacasino is where it’s at! Been hitting some serious wins lately. Legit site and easy to navigate. Give diwatacasino a try, you might get lucky like me!

    Resposta
  • Yo, just checked out phgreatcasinolink. Site’s pretty slick, got a good vibe. Games loaded smooth, and I actually had some luck! Definitely worth a look if you’re hunting for a new spot. Check it out here phgreatcasinolink

    Resposta
  • Honestly, 38winbet has grown on me. It’s not the prettiest site, but it gets the job done. Solid selection and decent odds. 38winbet

    Resposta
  • ok89bet is pretty okay. Not the best but it is not bad, especially for beginners I reckon! Give it a try. ok89bet

    Resposta
  • If you’re looking for a new spot for some jili games, jili777win is worth a look. Graphics are solid and the gameplay is smooth. What are you waiting for? More info here: jili777win

    Resposta
  • Yo, vnq8a is on my list of places to check out. Heard through the grapevine that it’s legit. Get your game on there: vnq8a

    Resposta
  • Yo, 99win33 ain’t bad. Got a good selection of games and betting options. Could use a little sprucing up but hey, if it works, it works! Just sayin’. 99win33

    Resposta
  • Yo, VS388 đăng nhập was smooth as butter today! No lag, no glitches, just straight into the action. Definitely worth checking out if you’re looking for a solid betting platform. Click here: vs388 đăng nhập

    Resposta
  • Ray bet, been hearing whispers about this. Worth checking out for some quick fun? Hit me up if you’ve tried it! Check it out here ray bet

    Resposta
  • SinagPH… sounds kinda mysterious! Anyone hitting it big there? Share your wins! Explore it here sinagph

    Resposta

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

YouTube
YouTube
Facebook
Facebook