Installing portainner on ubunto server permission denied - docker

So I just installed docker and installed home assistant on docker everything is working but now I want to install PORTAINER starting with this command
docker volume create portainer_data
**And when I press enter it gives me this message get permission denied while trying to connect to the docker daemon socket at unt x:///ver/run/docker and at last it says connect: permission denied
**
What should I do ? Iam new to ubunto and have no experience
I don't know what to do

Try this
sudo groupadd docker
and
sudo usermod -aG docker ${USER}
Also check all docker group users
grep /etc/group -e "docker"

Related

Docker Rancher - Permission Denied when using docker from WSL

I have installed Docker Rancher on Windows 10 with dockerd option and WSL on true for my current WSL distribution (Ubuntu).
When i try to use docker in WSL2, I had the following error:
fpapi#xxx:~$ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
The command works fine in the cmd shell.
Which kind of permission I'm missing?
The issue is that Docker Rancher installer do not create the docker group.
Use the following commands:
sudo addgroup --system docker
sudo adduser $USER docker
newgrp docker
# And something needs to be done so $USER always runs in group `docker` on the `Ubuntu` WSL
sudo chown root:docker /var/run/docker.sock
sudo chmod g+w /var/run/docker.sock
thanks to https://github.com/rancher-sandbox/rancher-desktop/issues/1156#issuecomment-1017042882

Preparation failed: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

Trying to transform a project in gitlab to docker image. The gitlab is selfhosted. This is the error I get:
Running with gitlab-runner 13.12.0 (7a6612da)
on test -KnwQXuT
Preparing the "docker" executor
ERROR: Failed to remove network for build
ERROR: Preparation failed: Got permission denied while trying to connect to the Docker daemon
socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.25/info: dial
unix /var/run/docker.sock: connect: permission denied (docker.go:858:0s)
I added a runner,registered it, created a gitlab-ci.yml with docker template which I left unmodified. As solutions I tried chmod 666 /var/run/docker.sock before and after adding the runner but it did not work. I also added sudo before running and registering the docker runner but still no success. I found another option to add my docker user to group docker but all my users are in the docker group. The docker runner is run as a docker image. I did not know what to do...Please help. I`m am trying for about 10 days with no success... Thanks in advance
Create docker group if not exist : sudo groupadd docker
Add user to docker group : sudo usermod -aG docker ${USER}
Change docker.sock to new permission : sudo chmod 666 /var/run/docker.sock
Finally restart docker daemon service : sudo systemctl restart docker
When you use gitlab self-hosted runner, by default, it creates a user named gitlab-runner. You need to assign the permissions to it.
sudo usermod -aG docker gitlab-runner
this will assign the correct permissions to the gitlab-runner and should pull the docker images on that VM.

configuration for Got permission denied while trying to connect to the Docker daemon socket does not save

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
I write theses commands to give me Sudo permission while I am working with docker in terminal
'''
sudo groupadd docker
sudo usermod -aG docker ${USER}
newgrp docker
'''
but after closing the terminal it does not save the configuration for next terminals that I am opening
Please restart the Docker service to take effect. If No luck. then restart should do the trick

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
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!)
add sudo to the command while you are pulling your docker images using curl.
sudo curl -sSL fabric-binaries-link | bash -s
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:
Create a new user
sudo adduser bibek
Add our user to the sudo group.
sudo usermod -aG sudo bibek
Switch to new user
su - bibek
Then you can install all docker and docker-compose
sudo apt-get install docker.io docker-compose
Start and enable docker
sudo usermod -a -G docker $USER
sudo systemctl start docker
sudo systemctl enable docker
You can check if the installation worked by running:
docker run hello-world
Cheers!

Got permission denied while trying to connect to the Docker daemon socket while executing docker build

I am trying to build docker image through Jenkins installed on Ubuntu 16.04.
However, getting the error stated :
"Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post".
Any suggestions are welcomed...Thanks!!!
Run the following commands
sudo usermod -a -G docker $USER
newgrp docker
Then run your command :-)

Resources