Perché sono costretto a eseguire docker con sudo su OS X?

Sto cercando di installare docker su macOS 10.12.1

Ho avuto una versione più vecchia di docker che ho rimosso dal sistema.

• Ho deciso di utilizzare l'ambiente Docker per Mac e sfruttare il hyperkit

• Non ho i contenitori esistenti con cui ho lavorato

• Ho eseguito un'installazione pulita dell'app App nativo di Mac e l'impostazione mostra che funziona correttamente

Problemi: l'esecuzione di docker ps come utente standard non riesce

 ➜ docker ps Cannot connect to the Docker daemon. Is the docker daemon running on this host? 

successo:

 ➜ sudo docker ps Password: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 

Domanda :

Come faccio a impedire l'esecuzione con i privilegi di root?

Informazioni addizionali

 ➜ bin ls -all | grep docker lrwxr-xr-x 1 jmurphy staff 67 Oct 29 21:43 docker -> /Users/jmurphy/Library/Group Containers/group.com.docker/bin/docker lrwxr-xr-x 1 jmurphy staff 75 Oct 29 21:43 docker-compose -> /Users/jmurphy/Library/Group Containers/group.com.docker/bin/docker-compose lrwxr-xr-x 1 jmurphy staff 75 Oct 29 21:43 docker-machine -> /Users/jmurphy/Library/Group Containers/group.com.docker/bin/docker-machine lrwxr-xr-x 1 jmurphy admin 75 Oct 29 20:50 docker-machine-driver-xhyve -> ../Cellar/docker-machine-driver-xhyve/0.2.3/bin/docker-machine-driver-xhyve lrwxr-xr-x 1 jmurphy staff 67 Oct 29 21:43 notary -> /Users/jmurphy/Library/Group Containers/group.com.docker/bin/notary ➜ bin ps aux | grep docker jmurphy 815 0.5 1.2 4742256 103108 ?? S 9:43PM 0:22.64 /Applications/Docker.app/Contents/MacOS/com.docker.hyperkit -A -m 2G -c 2 -u -s 0:0,hostbridge -s 31,lpc -s 2:0,virtio-vpnkit,uuid=58fa3bf4-bc44-4df1-b637-b459084abef7,path=/Users/jmurphy/Library/Containers/com.docker.docker/Data/s50,macfile=/Users/jmurphy/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/mac.0 -s 3,virtio-blk,file:///Users/jmurphy/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2,format=qcow -s 4,virtio-9p,path=/Users/jmurphy/Library/Containers/com.docker.docker/Data/s40,tag=db -s 5,virtio-rnd -s 6,virtio-9p,path=/Users/jmurphy/Library/Containers/com.docker.docker/Data/s51,tag=port -s 7,virtio-sock,guest_cid=3,path=/Users/jmurphy/Library/Containers/com.docker.docker/Data,guest_forwards=2376;1525 -l com1,autopty=/Users/jmurphy/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty,log=/Users/jmurphy/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/console-ring -f kexec,/Applications/Docker.app/Contents/Resources/moby/vmlinuz64,/Applications/Docker.app/Contents/Resources/moby/initrd.img,earlyprintk=serial console=ttyS0 com.docker.driver="com.docker.driver.amd64-linux", com.docker.database="com.docker.driver.amd64-linux" ntp=gateway mobyplatform=mac -F /Users/jmurphy/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/hypervisor.pid jmurphy 776 0.0 0.1 556636936 7780 ?? S 9:43PM 0:00.03 /Applications/Docker.app/Contents/MacOS/com.docker.driver.amd64-linux -db /Users/jmurphy/Library/Containers/com.docker.docker/Data/s40 -osxfs-volume /Users/jmurphy/Library/Containers/com.docker.docker/Data/s30 -slirp /Users/jmurphy/Library/Containers/com.docker.docker/Data/s50 -vmnet /var/tmp/com.docker.vmnetd.socket -port /Users/jmurphy/Library/Containers/com.docker.docker/Data/s51 -vsock /Users/jmurphy/Library/Containers/com.docker.docker/Data -docker /Users/jmurphy/Library/Containers/com.docker.docker/Data/s60 -addr fd:3 -debug jmurphy 773 0.0 0.0 556622812 4068 ?? S 9:43PM 0:00.09 /Applications/Docker.app/Contents/MacOS/com.docker.osx.hyperkit.linux jmurphy 772 0.0 0.1 556677904 11868 ?? Ss 9:43PM 0:00.27 com.docker.driver.amd64-linux -db /Users/jmurphy/Library/Containers/com.docker.docker/Data/s40 -osxfs-volume /Users/jmurphy/Library/Containers/com.docker.docker/Data/s30 -slirp /Users/jmurphy/Library/Containers/com.docker.docker/Data/s50 -vmnet /var/tmp/com.docker.vmnetd.socket -port /Users/jmurphy/Library/Containers/com.docker.docker/Data/s51 -vsock /Users/jmurphy/Library/Containers/com.docker.docker/Data -docker /Users/jmurphy/Library/Containers/com.docker.docker/Data/s60 -addr fd:3 -debug jmurphy 771 0.0 0.1 556627968 9128 ?? Ss 9:43PM 0:00.54 com.docker.osx.hyperkit.linux jmurphy 770 0.0 0.1 2513388 11132 ?? Ss 9:43PM 0:00.21 com.docker.slirp --db /Users/jmurphy/Library/Containers/com.docker.docker/Data/s40 --ethernet fd:3 --port fd:4 --vsock-path /Users/jmurphy/Library/Containers/com.docker.docker/Data/@connect --max-connections 900 jmurphy 769 0.0 0.2 2476848 12716 ?? Ss 9:43PM 0:00.45 com.docker.osxfs --address fd:3 --connect /Users/jmurphy/Library/Containers/com.docker.docker/Data/@connect --control fd:4 --volume-control fd:5 --database /Users/jmurphy/Library/Containers/com.docker.docker/Data/s40 jmurphy 768 0.0 0.1 2475860 12252 ?? Ss 9:43PM 0:01.61 com.docker.db --url fd:3 --git /Users/jmurphy/Library/Containers/com.docker.docker/Data/database jmurphy 767 0.0 0.0 556622812 3980 ?? S 9:43PM 0:00.10 /Applications/Docker.app/Contents/MacOS/com.docker.osx.hyperkit.linux -watchdog fd:0 jmurphy 764 0.0 0.1 556679780 6492 ?? S 9:43PM 0:00.07 /Applications/Docker.app/Contents/MacOS/com.docker.osx.hyperkit.linux -watchdog fd:0 jmurphy 1887 0.0 0.0 2432804 840 s000 R+ 10:18PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn docker root 100 0.0 0.0 2444416 1800 ?? Ss 9:43PM 0:00.01 /Library/PrivilegedHelperTools/com.docker.vmnetd jmurphy 1878 0.0 0.0 556614264 3888 ?? S 10:17PM 0:00.01 /Applications/Docker.app/Contents/MacOS/com.docker.frontend {"action":"vmstateevent","args":{"vmstate":"running"}} jmurphy 1877 0.0 0.0 556631812 4108 ?? S 10:17PM 0:00.01 /Applications/Docker.app/Contents/MacOS/com.docker.frontend {"action":"vmstateevent","args":{"vmstate":"running"}} 

Da Docs: Al momento dell'installazione, Docker for Mac fornisce un HyperKit VM basato su Linux Alpine, che esegue Docker Engine. Espone l'API docker su una presa in /var/tmp/docker.sock. Poiché questa è la posizione predefinita in cui appare il docker se non sono impostate variables di ambiente, è ansible iniziare a utilizzare il docker e la composizione docker senza impostare variables di ambiente.

https://docs.docker.com/docker-for-mac/docker-toolbox/

Sembra che il problema è stato causato da legacy entires nel mio file ~ / .zshrc.

Senza successo, ho seguito le fasi in cui le istruzioni mi hanno chiesto di eseguire:

  unset DOCKER_TLS_VERIFY unset DOCKER_CERT_PATH unset DOCKER_MACHINE_NAME unset DOCKER_HOST 

Tuttavia, se le voci in ~ / .zshrc (forse il tuo ~ / .bashrc) persistono – potrebbe essere necessario rimuovere manualmente e riavviare la session – dopo che si dovrebbe essere in grado di eseguire il command senza bisogno di sudo.

 ➜ ~ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 92176e251311 redis "docker-entrypoint.sh" 9 hours ago Up 9 hours 6379/tcp composetest_redis_1