Docker commands require sudo?

Expected behavior

Should be able to issue docker commands without the use of “sudo”. docker_machine didn’t require sudo.

Actual behavior

Can’t access docker daemon without using sudo. Existing scripts (e.g. SBT’s docker:publish) no longer work because they don’t sudo.

Information

$ pinata diagnose -u
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta12
Running diagnostic tests:
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[ERROR] environment the variables DOCKER_CERT_PATH DOCKER_TLS_VERIFY DOCKER_MACHINE_NAME DOCKER_HOST should not be set
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160520-155027.tar.gz
Most specific failure is: the variables DOCKER_CERT_PATH DOCKER_TLS_VERIFY DOCKER_MACHINE_NAME DOCKER_HOST should not be set
Your unique id is: 6C62EECB-4AA1-4C5A-B735-CBBAC6894AD1
Please quote this in all correspondence.

  • host distribution and version: 10.11.4 (15E65)

Steps to reproduce the behavior

  1. run "docker ps"
    get this error:
    $ docker ps
    Cannot connect to the Docker daemon. Is the docker daemon running on this host?

  2. run “sudo docker ps”
    $ sudo docker ps
    Password:
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

You need to unset any DOCKER* environment variables. Please see
https://beta.docker.com/docs/mac/faqs/

Hi,

The first step would be to take action on the errors reported by pinata:
[ERROR] environment the variables DOCKER_CERT_PATH DOCKER_TLS_VERIFY DOCKER_MACHINE_NAME DOCKER_HOST should not be set

Please unset those variables (check out your ~/.bashrc and ~/.bash_profile files)

Thanks much. This worked perfectly. I apologize for not noticing this (or reading the FAQ first!). — Eric

Thanks much. That did the trick. Guess I should have looked a little more carefully at that output. — Eric

This link is broken (404). Is there an updated FAQ that contains a description of this issue?

I didn’t dig for the FAQ that addressed this issue, but it’s pretty simple to get around. I had an older version of the toolbox installed on my mac, and when I upgraded to this I was stuck using sudo in order to run docker… until I found this:
[~]: env | grep DOCKER
DOCKER_HOST=tcp://localhost:4243

just:
unset DOCKER_HOST
and you should be good to go (at least for the current shell). As @aleveille mentioned, check files loaded by your shell. For me this was located here:
[~]: grep -Rn DOCKER .bash*
.bash_profile:69:## DOCKER STUFF
.bash_profile:70:export DOCKER_HOST=tcp://localhost:4243

for me this helped:

brew cask install docker

(its a ui app)
then open it from launcher