Docker Community Forums

Share and learn in the Docker community.

I get error in Hello-World how fix?


(Lsepolis123) #1

I get error in Hello-World how fix???

x@x-VirtualBox:~$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Δευ 2017-03-06 22:58:43 EET; 8min ago
Docs: https://docs.docker.com
Main PID: 6564 (dockerd)
Tasks: 17
Memory: 22.4M
CPU: 979ms
CGroup: /system.slice/docker.service
├─6564 /usr/bin/dockerd -H fd://
└─6572 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.so

Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.293199620+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.293340961+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.293770030+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.404856668+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.629897941+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.872810025+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.909443850+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.909687629+02:00” le
Μάρ 06 22:58:43 x-VirtualBox systemd[1]: Started Docker Application Container Engine.
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.931078139+02:00” le
…skipping…
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Δευ 2017-03-06 22:58:43 EET; 8min ago
Docs: https://docs.docker.com
Main PID: 6564 (dockerd)
Tasks: 17
Memory: 22.4M
CPU: 979ms
CGroup: /system.slice/docker.service
├─6564 /usr/bin/dockerd -H fd://
└─6572 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.so

Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.293199620+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.293340961+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.293770030+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.404856668+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.629897941+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.872810025+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.909443850+02:00” le
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.909687629+02:00” le
Μάρ 06 22:58:43 x-VirtualBox systemd[1]: Started Docker Application Container Engine.
Μάρ 06 22:58:43 x-VirtualBox dockerd[6564]: time=“2017-03-06T22:58:43.931078139+02:00” le
~
x@x-VirtualBox:~$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See ‘docker run --help’.
x@x-VirtualBox:~$


(Lsepolis123) #2

ubuntu 16.04 well how fix


(Think) #3

you should write sudo docker run hello-world or add your user x into the group docker.


(Darknerd) #4

After doing

$ sudo usermod -aG docker $USER
$ sudo systemctl restart docker

Got

$ docker ps
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.30/containers/json: dial unix /var/run/docker.sock: connect: permission denied

(Think) #5

had a newgrp docker or started a new shell that the group is also known to the current user?


(Bharathkumarraju) #6

just logout and login freshly it should for me it worked like that…see below

[bharath@docker ~]$ ls -l /var/run/docker.sock
srw-rw----. 1 root docker 0 Sep 27 06:30 /var/run/docker.sock
[bharath@docker ~]$ docker -v
Docker version 17.05.0-ce, build 89658be
[bharath@docker ~]$ docker ps
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.29/containers/json: dial unix /var/run/docker.sock: connect: permission denied
[bharath@docker ~]$ id bharath
uid=1001(bharath) gid=1001(bharath) groups=1001(bharath),994(docker)
[bharath@docker ~]$ logout
[root@docker yum.repos.d]# exit
[bharath@docker ~]$ logout
Connection to 0 closed.
[root@ip-10-0-1-151 ec2-user]# exit
[ec2-user@ip-10-0-1-151 ~]$ logout
Connection to 54.173.188.205 closed.
bharathkumars-MacBook-Air:Downloads bharathkumardasararaju$ ssh bharath@XX.XX.XX.XXX
Password:
Unable to get valid context for bharath
Last login: Wed Sep 27 06:21:35 2017
[bharath@docker ~]$ sudo su
[root@docker bharath]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@docker bharath]# exit
[bharath@docker ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[bharath@docker ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[bharath@docker ~]$


(Divsdockertest) #7

Worked for me! Thanks.