You are not logged in.

#1 2015-02-18 14:23:46

mascip
Member
Registered: 2015-02-10
Posts: 29

[SOLVED] Docker only runs as root, even though user is in docker group

Hi all, I have installed docker with pacman and enabled it:

$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2015-02-18 13:12:27 GMT; 1h 6min ago
     Docs: http://docs.docker.com
 Main PID: 560 (docker)
   CGroup: /system.slice/docker.service
           └─560 /usr/bin/docker -d -H fd://

Feb 18 13:12:29 mascip-toshiba docker[560]: time="2015-02-18T13:12:29Z" level="info" msg="docker daemon: 1.5.0 a8a31ef; execdriver: native...emapper"
[... more line ...]

And I have added user to the docker group:

$ cat /etc/group | grep docker
docker:x:142:user

But docker only runs as root:

$ sudo docker ps
[sudo] password for user: 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
$ docker ps
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host? 

Any idea why that might be? The documentation doesn't give any other instructions, and I didn't find any relevant advice online.

Last edited by mascip (2015-02-24 13:39:02)

Offline

#2 2015-02-18 16:41:30

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Did you log out completely or reboot and then try? Has to be done after adding your user to a new group

Scott

Offline

#3 2015-02-18 17:11:52

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

I have, several times. Thanks for the suggestion though smile

I really don't have a clue. It's either something very basic that I have missed (probably that), or a bug (I would be very surprised if that was the case).

Offline

#4 2015-02-18 17:26:21

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Have you started the docker daemon yet?

https://docs.docker.com/articles/systemd/


Knute

Offline

#5 2015-02-18 17:28:48

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

I think I have, as shown above by the result of

$ systemctl status docker

and by the fact that

$ sudo docker ps

works.

Offline

#6 2015-02-18 17:47:32

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] Docker only runs as root, even though user is in docker group

No, you have not, as evidenced by the result of "docker ps" that you ran as user.

Have you actually taken the time to read the error message?

The correct answer to that question is no, you have not read the error message; else you would have noticed it asking you if you had run "docker -d" on this host.
What that question is attempting to do is to clue you in to the fact that docker is a server-client type of an app, and that you do not have the server (or daemon) running.

The link that I included in my response gives you detailed instructions in how to start the daemon in systemd along with configuration options.  Perhaps you may want to take a moment and read those instructions.

HTH


Knute

Offline

#7 2015-02-18 17:52:16

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Outputs of:

$ groups
$ docker info
$ docker --version

I can't see any reason why it wouldn't work unless your system isn't picking up that you belong to that group yet. You installed docker from [community] ?

Scott

Edit: try uninstalling docker, delete /var/lib/docker, install docker, then reboot.

Last edited by firecat53 (2015-02-18 17:56:07)

Offline

#8 2015-02-18 21:53:17

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

$ groups
wheel docker user
$ sudo docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
 Pool Name: docker-8:1-265574-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: extfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 305.7 MB
 Data Space Total: 107.4 GB
 Metadata Space Used: 733.2 kB
 Metadata Space Total: 2.147 GB
 Udev Sync Supported: true
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.92 (2014-11-28)
Execution Driver: native-0.2
Kernel Version: 3.18.5-1-ARCH
Operating System: Arch Linux
CPUs: 4
Total Memory: 3.746 GiB
Name: mascip-toshiba
ID: 63HQ:ANMJ:AAOZ:BQAS:JB4V:C76N:R4A7:U2WL:UKRF:3LRJ:WH57:ZHQ2
WARNING: No swap limit support
$ docker --version
Docker version 1.5.0, build a8a31ef

Knute, I have read this page and others, and I had done

$ systemctl start docker

to start the daemon. I have confirmed that it's running, by doing

$ systemctl status docker

(see output in first message: it says that the daemon is active)
I also checked that the docker daemon is running, by doing

$ ps aux | grep docker
ps aux | grep docker
root       396  0.0  0.4 351184 19072 ?        Ssl  21:29   0:00 /usr/bin/docker -d -H fd://
user       957  0.0  0.0  10704  2240 pts/0    S+   21:41   0:00 grep --color=auto docker

Where I saw that it was started by root.

So I decided to try something else: stopping the daemon, and running it manually instead:
1. Stop the daemon:

$ systemctl stop docker

Check that it is stopped:

$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Wed 2015-02-18 21:43:05 GMT; 5s ago
     Docs: http://docs.docker.com
  Process: 396 ExecStart=/usr/bin/docker -d -H fd:// (code=exited, status=0/SUCCESS)
 Main PID: 396 (code=exited, status=0/SUCCESS)

Feb 18 21:29:52 mascip-toshiba docker[396]: time="2015-02-18T21:29:52Z" level="info" msg="+job acceptconnections()"
Feb 18 21:29:52 mascip-toshiba docker[396]: time="2015-02-18T21:29:52Z" level="info" msg="-job acceptconnections() = OK (0)"
Feb 18 21:34:52 mascip-toshiba docker[396]: time="2015-02-18T21:34:52Z" level="info" msg="GET /v1.17/info"
Feb 18 21:34:52 mascip-toshiba docker[396]: time="2015-02-18T21:34:52Z" level="info" msg="+job info()"
Feb 18 21:34:52 mascip-toshiba docker[396]: time="2015-02-18T21:34:52Z" level="info" msg="+job subscribers_count()"
Feb 18 21:34:52 mascip-toshiba docker[396]: time="2015-02-18T21:34:52Z" level="info" msg="-job subscribers_count() = OK (0)"
Feb 18 21:34:52 mascip-toshiba docker[396]: time="2015-02-18T21:34:52Z" level="info" msg="+job registry_config()"
Feb 18 21:34:52 mascip-toshiba docker[396]: time="2015-02-18T21:34:52Z" level="info" msg="-job registry_config() = OK (0)"
Feb 18 21:34:52 mascip-toshiba docker[396]: time="2015-02-18T21:34:52Z" level="info" msg="-job info() = OK (0)"
Feb 18 21:43:05 mascip-toshiba docker[396]: time="2015-02-18T21:43:05Z" level="info" msg="Received signal 'terminated', starting shutdown ...cker..."
Hint: Some lines were ellipsized, use -l to show in full.

$ ps aux | grep docker
user       994  0.0  0.0  10700  2288 pts/0    S+   21:43   0:00 grep --color=auto docker

3. Start the daemon manually:

$ docker -d &
[1] 999
$ INFO[0000] +job serveapi(tcp://127.0.0.1:4243)          
FATA[0000] open /var/run/docker.pid: permission denied  

[1]+  Exit 1                  docker -H=tcp://127.0.0.1:4243 -d

And the result I get is "permission denied", which confirms that it's a problem with permissions.

I'm going to try what you said, firecat53. Thank you!
Thank you for your insistence Knute, it made me investigate further.

Offline

#9 2015-02-24 11:22:29

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Hi, sorry I didn't get back to you sooner. My boat sank a few days ago, so I have had to deal with this, and been off work.

So... I uninstalled docker, removed /var/lib/docker, and re-installed docker, without success: I can still run commands as sudo, but not as a simple user.
I'm thinking of filing a bug report, but guessing that it's probably a detail I forgot.

Here is exactly what I did:

user@mascip-toshiba:~$ sudo pacman -Rs docker
checking dependencies...

Packages (2) bridge-utils-1.5-2  docker-1:1.5.0-1

Total Removed Size:  19.84 MiB

:: Do you want to remove these packages? [Y/n] 
(1/2) removing docker                                                                     [####################################################] 100%
(2/2) removing bridge-utils                                                               [####################################################] 100%

user@mascip-toshiba:~$ sudo rm -r /var/lib/docker/

user@mascip-toshiba:~$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2015-02-18 22:11:16 GMT; 4min 5s ago
     Docs: http://docs.docker.com
 Main PID: 587 (docker)
   CGroup: /system.slice/docker.service
           └─587 /usr/bin/docker -d -H fd://

Feb 18 22:11:18 mascip-toshiba docker[587]: time="2015-02-18T22:11:18Z" level="info" msg="-job init_networkdriver() = OK (0)"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="WARNING: Your kernel does not support cgroup swap limit."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="Loading containers: start."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="Loading containers: done."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="docker daemon: 1.5.0 a8a31ef; execdriver: native...emapper"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="+job acceptconnections()"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="-job acceptconnections() = OK (0)"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="GET /v1.17/containers/json"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="+job containers()"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="-job containers() = OK (0)"

Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended.
Hint: Some lines were ellipsized, use -l to show in full.

user@mascip-toshiba:~$ systemctl daemon-reload

user@mascip-toshiba:~$ systemctl status docker
● docker.service
   Loaded: not-found (Reason: No such file or directory)
   Active: active (running) since Wed 2015-02-18 22:11:16 GMT; 4min 52s ago
 Main PID: 587 (docker)
   CGroup: /system.slice/docker.service
           └─587 /usr/bin/docker -d -H fd://

Feb 18 22:11:18 mascip-toshiba docker[587]: time="2015-02-18T22:11:18Z" level="info" msg="-job init_networkdriver() = OK (0)"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="WARNING: Your kernel does not support cgroup swap limit."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="Loading containers: start."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="Loading containers: done."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="docker daemon: 1.5.0 a8a31ef; execdriver: native...emapper"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="+job acceptconnections()"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="-job acceptconnections() = OK (0)"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="GET /v1.17/containers/json"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="+job containers()"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="-job containers() = OK (0)"
Hint: Some lines were ellipsized, use -l to show in full.

user@mascip-toshiba:~$ systemctl stop docker

user@mascip-toshiba:~$ systemctl status docker
● docker.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead) since Wed 2015-02-18 22:16:19 GMT; 3s ago
 Main PID: 587 (code=exited, status=0/SUCCESS)

Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="WARNING: Your kernel does not support cgroup swap limit."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="Loading containers: start."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="Loading containers: done."
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="docker daemon: 1.5.0 a8a31ef; execdriver: native...emapper"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="+job acceptconnections()"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="-job acceptconnections() = OK (0)"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="GET /v1.17/containers/json"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="+job containers()"
Feb 18 22:11:19 mascip-toshiba docker[587]: time="2015-02-18T22:11:19Z" level="info" msg="-job containers() = OK (0)"
Feb 18 22:16:19 mascip-toshiba docker[587]: time="2015-02-18T22:16:19Z" level="info" msg="Received signal 'terminated', starting shutdown ...cker..."
Hint: Some lines were ellipsized, use -l to show in full.

user@mascip-toshiba:~$ sudo reboot
user@mascip-toshiba:~$ systemctl status docker
● docker.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
user@mascip-toshiba:~$ systemctl | grep docker
user@mascip-toshiba:~$ pacman -Sy docker
error: you cannot perform this operation unless you are root.
user@mascip-toshiba:~$ sudo pacman -Sy docker
[sudo] password for user: 
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
resolving dependencies...
looking for conflicting packages...

Packages (2) bridge-utils-1.5-2  docker-1:1.5.0-1

Total Installed Size:  19.84 MiB

:: Proceed with installation? [Y/n] 
(2/2) checking keys in keyring                                                            [####################################################] 100%
(2/2) checking package integrity                                                          [####################################################] 100%
(2/2) loading package files                                                               [####################################################] 100%
(2/2) checking for file conflicts                                                         [####################################################] 100%
(2/2) checking available disk space                                                       [####################################################] 100%
(1/2) installing bridge-utils                                                             [####################################################] 100%
(2/2) installing docker                                                                   [####################################################] 100%
Optional dependencies for docker
    btrfs-progs: btrfs backend support
    lxc: lxc backend support [installed]
user@mascip-toshiba:~$ cat /etc/group
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin
adm:x:4:root,daemon
tty:x:5:
disk:x:6:root
lp:x:7:daemon
mem:x:8:
kmem:x:9:
wheel:x:10:root,user
ftp:x:11:
mail:x:12:
uucp:x:14:
log:x:19:root
utmp:x:20:
locate:x:21:
rfkill:x:24:
smmsp:x:25:
http:x:33:
games:x:50:
lock:x:54:
uuidd:x:68:
dbus:x:81:
network:x:90:
video:x:91:
audio:x:92:
optical:x:93:
floppy:x:94:
storage:x:95:
scanner:x:96:
input:x:97:
power:x:98:
nobody:x:99:
users:x:100:
systemd-journal:x:190:
systemd-journal-gateway:x:191:
systemd-timesync:x:192:
systemd-network:x:193:
systemd-bus-proxy:x:194:
systemd-resolve:x:195:
systemd-journal-remote:x:999:
systemd-journal-upload:x:998:
user:x:1000:
avahi:x:84:
polkitd:x:102:
lxdm:x:121:
git:x:997:
colord:x:124:
docker:x:142:
user@mascip-toshiba:~$ cat /etc/group | grep docker
docker:x:142:
user@mascip-toshiba:~$ sudo usermod -aG docker user
user@mascip-toshiba:~$ cat /etc/group | grep docker
docker:x:142:user
user@mascip-toshiba:~$ systemctl status docker
● docker.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
user@mascip-toshiba:~$ systemctl start docker
Failed to start docker.service: Unit docker.service failed to load: No such file or directory.
user@mascip-toshiba:~$ docker --version
Docker version 1.5.0, build a8a31ef
user@mascip-toshiba:~$ systemctl start docker.service
Failed to start docker.service: Unit docker.service failed to load: No such file or directory.
user@mascip-toshiba:~$ 
user@mascip-toshiba:~$ systemctl enable docker
user@mascip-toshiba:~$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: http://docs.docker.com
user@mascip-toshiba:~$ systemctl start docker.service
user@mascip-toshiba:~$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2015-02-18 22:23:38 GMT; 2s ago
     Docs: http://docs.docker.com
 Main PID: 896 (docker)
   CGroup: /system.slice/docker.service
           ├─896 /usr/bin/docker -d -H fd://
           └─933 mkfs.ext4 -E nodiscard,lazy_itable_init=0,lazy_journal_init=0 /dev/mapper/docker-8:1-264362-base

Feb 18 22:23:38 mascip-toshiba docker[896]: time="2015-02-18T22:23:38Z" level="info" msg="+job serveapi(fd://)"
Feb 18 22:23:38 mascip-toshiba docker[896]: time="2015-02-18T22:23:38Z" level="info" msg="Listening for HTTP on fd ()"
user@mascip-toshiba:~$ docker info
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host? 
user@mascip-toshiba:~$ docker ps
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host? 
user@mascip-toshiba:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
user@mascip-toshiba:~$ sudo reboot
user@mascip-toshiba:~$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2015-02-18 22:26:27 GMT; 2min 58s ago
     Docs: http://docs.docker.com
 Main PID: 573 (docker)
   CGroup: /system.slice/docker.service
           └─573 /usr/bin/docker -d -H fd://

Feb 18 22:26:28 mascip-toshiba docker[573]: time="2015-02-18T22:26:28Z" level="info" msg="+job serveapi(fd://)"
Feb 18 22:26:28 mascip-toshiba docker[573]: time="2015-02-18T22:26:28Z" level="info" msg="Listening for HTTP on fd ()"
Feb 18 22:26:28 mascip-toshiba docker[573]: time="2015-02-18T22:26:28Z" level="info" msg="+job init_networkdriver()"
Feb 18 22:26:28 mascip-toshiba docker[573]: time="2015-02-18T22:26:28Z" level="info" msg="-job init_networkdriver() = OK (0)"
Feb 18 22:26:29 mascip-toshiba docker[573]: time="2015-02-18T22:26:29Z" level="info" msg="WARNING: Your kernel does not support cgroup swap limit."
Feb 18 22:26:29 mascip-toshiba docker[573]: time="2015-02-18T22:26:29Z" level="info" msg="Loading containers: start."
Feb 18 22:26:29 mascip-toshiba docker[573]: time="2015-02-18T22:26:29Z" level="info" msg="Loading containers: done."
Feb 18 22:26:29 mascip-toshiba docker[573]: time="2015-02-18T22:26:29Z" level="info" msg="docker daemon: 1.5.0 a8a31ef; execdriver: native...emapper"
Feb 18 22:26:29 mascip-toshiba docker[573]: time="2015-02-18T22:26:29Z" level="info" msg="+job acceptconnections()"
Feb 18 22:26:29 mascip-toshiba docker[573]: time="2015-02-18T22:26:29Z" level="info" msg="-job acceptconnections() = OK (0)"
Hint: Some lines were ellipsized, use -l to show in full.
user@mascip-toshiba:~$ ps aux | grep docker
root       573  0.1  0.4 277452 17544 ?        Ssl  22:26   0:00 /usr/bin/docker -d -H fd://
user       847  0.0  0.0  10704  2340 pts/0    S+   22:29   0:00 grep --color=auto docker
user@mascip-toshiba:~$ docker ps
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host? 
user@mascip-toshiba:~$ sudo docker ps
[sudo] password for user: 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

As you can see, I can still run docker commands with sudo, but not as a simple user.

Last edited by mascip (2015-02-24 12:11:43)

Offline

#10 2015-02-24 11:58:03

mkoskar
Member
Registered: 2014-07-16
Posts: 64
Website

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Hmm, can you post again:

+0:~$ groups              
sys adm lp wheel rfkill games video users vboxusers wireshark systemd-journal docker miro

+0:~$ ls -al /run/docker.*
-rw-r--r-- 1 root root   5 Feb 24 10:55 /run/docker.pid
srw-rw---- 1 root docker 0 Feb 23 21:26 /run/docker.sock

Offline

#11 2015-02-24 12:39:08

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

user@mascip-toshiba:~$ groups
wheel docker user
user@mascip-toshiba:~$ ls -al /run/docker.*
-rw-r--r-- 1 root root   4 Feb 24 09:51 /run/docker.pid
srw-rw---- 1 root docker 0 Feb 24 09:49 /run/docker.sock

Offline

#12 2015-02-24 12:54:17

mkoskar
Member
Registered: 2014-07-16
Posts: 64
Website

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Seems OK, let's try:

+0:~$ systemctl list-sockets | grep docker
/var/run/docker.sock         docker.socket                   docker.service

+0:~$ systemctl list-units | grep docker  
sys-devices-virtual-net-docker0.device                                                    loaded active plugged   /sys/devices/virtual/net/docker0
sys-subsystem-net-devices-docker0.device                                                  loaded active plugged   /sys/subsystem/net/devices/docker0
home-docker-btrfs.mount                                                                   loaded active mounted   /home/docker/btrfs
home-docker.mount                                                                         loaded active mounted   /home/docker
docker.service                                                                            loaded active running   Docker Application Container Engine
docker.socket                                                                             loaded active running   Docker Socket for the API

Offline

#13 2015-02-24 12:55:26

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

user@mascip-toshiba:~$ systemctl list-sockets | grep docker
/var/run/docker.sock         docker.socket                   docker.service

user@mascip-toshiba:~$ systemctl list-units | grep docker  
sys-devices-virtual-net-docker0.device                                                              loaded active plugged   /sys/devices/virtual/net/docker0
sys-subsystem-net-devices-docker0.device                                                            loaded active plugged   /sys/subsystem/net/devices/docker0
docker.service                                                                                      loaded active running   Docker Application Container Engine
docker.socket                                                                                       loaded active running   Docker Socket for the API

Last edited by mascip (2015-02-24 12:55:36)

Offline

#14 2015-02-24 13:02:04

mkoskar
Member
Registered: 2014-07-16
Posts: 64
Website

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Seems good, let's try:

+0:bin$ command -v docker
/usr/bin/docker

+0:bin$ socat unix-connect:/run/docker.sock -
GET / HTTP/1.1

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
Date: Tue, 24 Feb 2015 13:02:11 GMT
Content-Length: 19

404 page not found

HTTP/1.1 400 Bad Request

Offline

#15 2015-02-24 13:09:18

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

user@mascip-toshiba:~$ command -v docker
alias docker='docker -H=tcp://127.0.0.1:4243'

socat unix-connect:/run/docker.sock -
GET / HTTP/1.1

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
Date: Tue, 24 Feb 2015 13:06:45 GMT
Content-Length: 19

404 page not found

HTTP/1.1 400 Bad Request

Haha, here is something potentially relevant: I had forgotten that I had this docker alias (copy-pasted from another computer's /home directory).
I will comment it and restart the machine, and report back in a minute.

Offline

#16 2015-02-24 13:16:35

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Now it's working, it was all because of this alias.
Thank you so much for your help mkoskar! I feel like I'm having a much better day, all of a sudden :-)

Offline

#17 2015-02-24 13:22:32

mkoskar
Member
Registered: 2014-07-16
Posts: 64
Website

Re: [SOLVED] Docker only runs as root, even though user is in docker group

mascip wrote:

Now it's working, it was all because of this alias.
Thank you so much for your help mkoskar! I feel like I'm having a much better day, all of a sudden :-)

No problem smile. I'm glad it's working now. If you are not using ZSH already, I would suggest it ... among other things it will color aliases with different color so it's easy to spot when you're using alias and when not.

PS: I guess you can mark this thread as [SOLVED] then

Offline

#18 2015-02-24 13:40:37

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Marked as solved. I am using zsh but it doesn't color aliases. Is there a specific configuration option for this? I cannot find it online.

Offline

#19 2015-02-24 14:25:15

mkoskar
Member
Registered: 2014-07-16
Posts: 64
Website

Re: [SOLVED] Docker only runs as root, even though user is in docker group

mascip wrote:

Marked as solved. I am using zsh but it doesn't color aliases. Is there a specific configuration option for this? I cannot find it online.

Aha, sorry you are right, it's not built-in. You would want to spend some time with configuring it (see below), I'm not sure how it looks by default.

$ pacman -Ss zsh-syntax
community/zsh-syntax-highlighting 0.2.1-1 [installed]
    Fish shell like syntax highlighting for Zsh

Offline

#20 2015-02-24 14:29:58

mascip
Member
Registered: 2015-02-10
Posts: 29

Re: [SOLVED] Docker only runs as root, even though user is in docker group

Amazing, cheers!

Offline

#21 2016-09-01 13:39:28

Kavinkumar
Member
Registered: 2016-09-01
Posts: 1

Re: [SOLVED] Docker only runs as root, even though user is in docker group

I have a similar issue. But my output for

-> systemctl list-sockets | grep docker  ---No output---

-> systemctl list-units | grep docker

sys-devices-virtual-net-docker0.device                                      loaded active plugged   /sys/devices/virtual/net/docker0
sys-subsystem-net-devices-docker0.device                                    loaded active plugged   /sys/subsystem/net/devices/docker0
var-lib-docker-devicemapper.mount                                          loaded active mounted   /var/lib/docker/devicemapper
docker.service                                                              loaded active running   Docker Application Container Engine

----

-> sudo systemctl status docker.socket

● docker.socket - Docker Socket for the API
   Loaded: loaded (/usr/lib/systemd/system/docker.socket; disabled; vendor preset: disabled)
   Active: inactive (dead)
   Listen: /var/run/docker.sock (Stream)

Sep 01 12:00:24 zbooks-cent7-temp2 systemd[1]: Closed Docker Socket for the API.
Sep 01 12:00:24 zbooks-cent7-temp2 systemd[1]: Stopping Docker Socket for the API.
Sep 01 12:00:31 zbooks-cent7-temp2 systemd[1]: Starting Docker Socket for the API.
Sep 01 12:00:31 zbooks-cent7-temp2 systemd[1]: Listening on Docker Socket for the API.
Sep 01 12:01:35 zbooks-cent7-temp2 systemd[1]: Closed Docker Socket for the API.
Sep 01 12:01:35 zbooks-cent7-temp2 systemd[1]: Stopping Docker Socket for the API.
Sep 01 12:03:34 zbooks-cent7-temp2 systemd[1]: Starting Docker Socket for the API.
Sep 01 12:03:34 zbooks-cent7-temp2 systemd[1]: Listening on Docker Socket for the API.
Sep 01 12:17:03 zbooks-cent7-temp2 systemd[1]: Closed Docker Socket for the API.
Sep 01 12:17:03 zbooks-cent7-temp2 systemd[1]: Stopping Docker Socket for the API.

-----

And there is no 'docker.socket'  file in the path 'usr/lib/systemd/system/'


mascip wrote:
user@mascip-toshiba:~$ systemctl list-sockets | grep docker
/var/run/docker.sock         docker.socket                   docker.service

user@mascip-toshiba:~$ systemctl list-units | grep docker  
sys-devices-virtual-net-docker0.device                                                              loaded active plugged   /sys/devices/virtual/net/docker0
sys-subsystem-net-devices-docker0.device                                                            loaded active plugged   /sys/subsystem/net/devices/docker0
docker.service                                                                                      loaded active running   Docker Application Container Engine
docker.socket                                                                                       loaded active running   Docker Socket for the API

Last edited by Kavinkumar (2016-09-01 13:43:50)

Offline

Board footer

Powered by FluxBB