2
respostas

Nao funciona Hello-world - sem sudo e com sudo

nttdata@LAZARO-NOTE-LG:~$ sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
nttdata@LAZARO-NOTE-LG:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
containerd.io is already the newest version (1.6.7-1).
docker-ce-cli is already the newest version (5:20.10.17~3-0~ubuntu-jammy).
docker-ce is already the newest version (5:20.10.17~3-0~ubuntu-jammy).
docker-compose-plugin is already the newest version (2.6.0~ubuntu-jammy).
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 62 not upgraded.
nttdata@LAZARO-NOTE-LG:~$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
nttdata@LAZARO-NOTE-LG:~$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
nttdata@LAZARO-NOTE-LG:~$
2 respostas

Olá Lazaro, tudo bem?

Tenta rodar no seu terminar:

systemctl start docker

depois tente rodar novamente:

sudo docker run hello-world

Só para complementar a resposta do Otávio, após iniciar o serviço do docker, e quiser executar os comandos dockers sem digitar o sudo, basta seguir os seguinte comando, que no caso é adicionar nosso usuário ao grupo docker:

sudo usermod -aG docker ${USER}