I am on ubuntu 14.04 and unless I use sudo to run docker commands I get this error:
$ docker images
An error occurred trying to connect: Get http://vagrant.f8:2375/v1.24/images/json: dial tcp: lookup vagrant.f8 on 127.0.0.1:53: no such host
I have uninstalled vagrant, re-installed docker and still have this error. Is this some kind of baked in config that I haven't been able to remove?
The $DOCKER_HOST is used to tell the docker CLI where to connect for all commands. It looks like you've configured yours, possibly from a docker-machine setting, to a host you're no longer using. You can unset $DOCKER_HOST to send all requests to the local /var/run/docker.sock socket. Or you can configure it to match the value of your root user.
Docker can be configured to listen to 2375 (unencrypted) or 2376 (tls certificate setup required) with additional flags to the daemon, but if you have not configured these, unsetting the variable is most likely your solution. If you were using docker-machine, then eval $(docker-machine env -u) is likely what you want to run.
Related
My Problem is similar to the other two Questions:starting tutorial and Timeout on windows 2016. But none of it resolved my problem. (on my other search I didn't find any articles that could help my case > search timeout)
For any of the following commands:
docker run hello-world
docker pull hello-world
docker login -u user -p pass
I get the same error:
My proxies are correctly set to my cntlm service:
when I try to get the address with curl I get the following answer:
My docker version:
Docker info:
I've tried all the troubleshoot from this link (create a new default docker machine and so on)
Do you have any idea what could I do to download hello-world (or other) container?
Finally I got it:
First of all the client should be the same Version as the Server (now both are 1.13.1)
Second because I am using a Cntlm I have to create a Tunnel to forward my port from the Cntlm configuration.
ssh -R tunnelPort:proxy-Cntlm docker#ip.docker.machine
where:
tunnelPort will be used on the docker-machine (ex: 3000 for 127.0.0.1:3000)
proxy-Cntlm is the ip + port from cntlm.ini (ex: 127.0.0.1:3128)
ip.docker.machine it can be found simply by running docker-machine ls
One more thing! you have to adjust the ~/.ssh/config (at least for cygwin)
Host docker 192.168.99.100
Hostname 192.168.99.100
IdentityFile "path/to/id_rsa"
#on windows it is C:/Users/user/.docker/machine/machines/default/id_rsa when you have a default Machine
I want to be able to user docker-compose with a remote daemon. I created a local forward to the remote daemon socket like so:
#!/bin/sh
export SOCKET_DIR=$HOME/.remote-sockets
mkdir -p $SOCKET_DIR
echo "Creating SSH Dokcer Socket Tunnel"
socat "UNIX-LISTEN:/$SOCKET_DIR/docker.sock,reuseaddr,fork" \
EXEC:'ssh freebsd#107.170.216.79 socat STDIO UNIX-CONNECT\:/var/run/docker.sock'
With that script running, I export the following environment variables:
DOCKER_API_VERSION 1.19
COMPOSE_API_VERSION 1.19
DOCKER_HOST unix://$HOME/.remote-sockets/docker.sock
With those variables set, I can verify running docker ps shows me the remote containers and not my local daemon's containers. Furthermore, docker-compose ps also seems to connect to the remote daemon, as it returns an empty list. If I shut down the SSH tunnel, it fails saying it can't connect to the docker daemon.
The trouble is when I try to run docker-compose up. I've also tried docker-compose -H unix://$HOME/.remote-sockets/docker.sock up. Both commands give me the following:
ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
Local Versions:
Docker version 1.11.0, build 4dc5990
docker-compose version 1.8.0, build 94f7016
(Gentoo Linux)
Remote Versions:
Docker version 1.7.0-dev, build 582db78
(FreeBSD 11.0-RELEASE-p1)
Why won't docker-compose up work with a different socket when the other commands seem to communicate with it fine?
I have added
DOCKER_OPTS="-H tcp://0.0.0.0:2375"
to /etc/default/docker to make the Docker API accessible on my host machine (I'm running Docker in Virtualbox on an Ubuntu VM). However, when I try to run any Docker commands now, I just get this error message:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
I have tried sudo service docker restart, and restarted the machine, but nothing has worked. Any idea what the problem is?
To use the daemon through the tcp socket the option -H tcp://0.0.0.0:2375 should be added to the command docker (both for the daemon and run).
To access the daemon with its default unix socket make sure that the Docker daemon is also started with the option -H=unix:///var/run/docker.sock.
Note that using the tcp is dangerous if you do not trust the network you are in. Here is the doc from the man page:
-H, --host=[unix:///var/run/docker.sock]: tcp://[host]:[port][path] to bind or unix://[/path/to/socket] to use.
The socket(s) to bind to in daemon mode specified using one or more
tcp://host:port/path, unix:///path/to/socket, fd://* or fd://socketfd.
If the tcp port is not specified, then it will default to either 2375 when
--tls is off, or 2376 when --tls is on, or --tlsverify is specified.
I have following error when I try to use docker on my Mac:
FATA[0000] Get http:///var/run/docker.sock/v1.17/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
It doesn't matter if I use sudo or not... It doesn't matter which docker command I use or if I use brew or boot2docker to install it...
What should I do to resolve this issue ?
The Docker daemon does not run natively on a Mac. Until it does, there will never be a socket for communicating with the daemon at /var/run/. You must therefore use TCP to communicate with the daemon because the daemon must be running on another machine (or a VM). Unix sockets only talk to processes running on the local machine. The unix socket method is very secure since it is only on the local machine and you must be root (or in the docker group) to talk with this socket.
Insecure (but easy) TCP Client-Server Communications
You can run the Docker Engine in a very insecure way by setting some environment variables on the client end and starting your daemon in an insecure way on the daemon end:
Client: substitute the machine's host IP and port
DOCKER_HOST=tcp://host:2375
DOCKER_TLS_VERIFY=0
Daemon
docker -d -H tcp://0.0.0.0:2375
(see also https://docs.docker.com/reference/commandline/cli/#daemon-socket-option)
Secure TCP Communications
Since you probably don't want random people talking to your docker daemon over the internet, you should run with TLS enabled. That's complicated, but all the steps are listed in the docs. boot2docker and kitematic on Macs hides this complexity by setting up the TLS certificates for you and setting the environment variables needed to find the daemon.
I just installed Docker on mu Ubuntu 14.10 64 bit OS and I followed the steps to create the necessary certificates and keys so that I can secure my docker http remote connections. When I tried to issue the following command,
sudo docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem -H=x.x.x.x:2376 version
I get to see the following error message:
Cannot connect to the Docker daemon. Is 'docker -d' running on this host
The -H=x.x.x.x is the host as I see when I did a ifconfig and found the host from the docker0 entry that was listed.
Please help me identify why I'm not able to do anything with my daemon.
Did you change the options on the daemon itself? Paraphrasing the docs:
You can listen on port 2376 on all network interfaces with -H tcp://0.0.0.0:2376, or on a particular network interface using its IP address: -H tcp://192.168.59.103:2376.
To do this you could edit /etc/init/docker.conf and update the DOCKER_OPTS variable
Sometime ago i had this issue :
"Cannot connect to the Docker daemon at tcp://127.0.0.1:2376. Is the docker daemon running?"
Looking an your question, you did not specify if you are working on Ubuntu WSL (Bash).
Regardless of your env configuration.
Looking for the file ".bashrc" in your
add the following to it
export DOCKER_HOST=tcp://192.168.59.103:2376
Happy Devops!