Running docker as sudo
The DOCKER_HOST
environment variable isn't set. You can confirm this by doing:
> env
Then as sudo:
> sudo env
Without the DOCKER_HOST
variable set, docker can't connect to the daemon.
Try:
sudo DOCKER_HOST=$DOCKER_HOST docker run
This way the required environment variable will be available with sudo
.
If you want the DOCKER_HOST
variable from your profile to be available when you run docker command with sudo, then you can add the following line to sudoers
file. Open with:
sudo visudo
Add:
Defaults env_keep += "DOCKER_HOST"