Filip Laurentiu
Filip Laurentiu

Reputation: 938

Docker on Ubuntu inside WSL

I want to play with hyperledger fabric and this require to have linux. Right now I want to use Windows and my idea was to install Ubuntu with WSL and just develop inside it. The problem apear when I want to use docker.

I follow the steps in this tutorial step by step but I run into some problem.

filip@CSGN044D:~$ docker --version
Docker version 19.03.5, build 633a0ea838


filip@CSGN044D:~$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.


filip@CSGN044D:~$ sudo service docker start
 * Starting Docker: docker

and again...

filip@CSGN044D:~$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

Is this even possible ?

Upvotes: 1

Views: 1804

Answers (1)

prithajnath
prithajnath

Reputation: 2115

Looks like your Docker CLI is still trying to connect to the local Unix socket instead of localhost. Make sure your DOCKER_HOST environment variable is set to tcp://localhost:2375

Try by setting it in your shell first

export DOCKER_HOST=tcp://localhost:2375

Sanity check

echo $DOCKER_HOST

Now try running all your regular Docker commands. If those work, add this to your .bashrc

echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc
source ~/.bashrc

Not that in the tutorial the author uses localhost:2375 instead of tcp://localhost:2375. I think you have to explicitly specify the protocol. Also, your shell might not be using bash_profile as the config file (Usually Mac shells use that) so try adding it to your bashrc instead.

Upvotes: 2

Related Questions