LoV_a
LoV_a

Reputation: 29

Having Trouble Downloading Hyperledger fabric docker images

Background: I just downloaded docker, docker-compose, node.js,npm, and the hyperledger samples from the offical documentation. However, when I downloaded the hyperledger sample networks,everything seemed to be going fine until the script tried pulling the Hyperledger fabric docker images. This is the error message:

===> Pulling fabric Images

====> hyperledger/fabric-peer:2.1.0

Got permission denied while trying to connect to the Docker daemon socket at unix:///var
/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images
/create?fromImage=hyperledger%2Ffabric-peer&tag=2.1.0: dial unix /var/run/docker.sock: 
connect: permission denied

NOTE: I am using ubuntu 18.04.4

Upvotes: 0

Views: 490

Answers (3)

Bibek Poudel
Bibek Poudel

Reputation: 116

A temporary solution would be to change the permission of docker.sock file

Go the terminal and type the following and press enter.

sudo chmod 775 //var/run/docker.sock

However, it is not advised to use the root user for installing software for fabric. Instead, you can do the following:

  1. Create a new user

    sudo adduser bibek
    
  2. Add our user to the sudo group.

    sudo usermod -aG sudo bibek
    
  3. Switch to new user

    su - bibek
    
  4. Then you can install all docker and docker-compose

    sudo apt-get install docker.io docker-compose
    
  5. Start and enable docker

    sudo usermod -a -G docker $USER 
    sudo systemctl start docker 
    sudo systemctl enable docker
    
  6. You can check if the installation worked by running:

    docker run hello-world 
    

Cheers!

Upvotes: 0

Satish Chandra Medi
Satish Chandra Medi

Reputation: 86

add sudo to the command while you are pulling your docker images using curl.

sudo curl -sSL fabric-binaries-link | bash -s

Upvotes: 0

Philipp Claßen
Philipp Claßen

Reputation: 43940

I'm guessing: either the Docker service is not running, or your user does not have permission to access the Docker service (more likely).

Running your command as sudo is one way to fix it. Or have a look at this question: How can I use docker without sudo? (but be careful about the security trade-offs!)

Upvotes: 1

Related Questions