Showing posts with label docker. Show all posts
Showing posts with label docker. Show all posts

Tuesday, December 1, 2020

Fix docker: Got permission denied while trying to connect to the Docker daemon socket

 According to the official Docker docs here:

https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user

You need to do the following:

To create the docker group and add your user:

  • Create the docker group.
sudo groupadd docker
  • Add your user to the docker group.
sudo usermod -aG docker ${USER}
  • You would need to loog out and log back in so that your group membership is re-evaluated or type the following command:
su -s ${USER}
  • Verify that you can run docker commands without sudo.
docker run hello-world
  • This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

  • If you initially ran Docker CLI commands using sudo before adding your user to the docker group, you may see the following error, which indicates that your ~/.docker/ directory was created with incorrect permissions due to the sudo commands.

WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied
  • To fix this problem, either remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R

Monday, September 24, 2018

Docker network error

When try the example in
https://docs.docker.com/get-started/part2/#build-the-app

Error:
pip network error
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 404 Not Found',))': /simple/flask/

Solution:
Along with below Proxy configuration in DockerFile

ENV http_proxy http://proxy-chain.xxx.com:911/
ENV https_proxy http://proxy-chain.xxx.com:912/

and use docker build command with following argument


$ docker build --no-cache --network=host -t friendlyhello .

Error
 RUN apt-get update && apt-get upgrade -y python3-pip
Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'archive.ubuntu.com'

Solution

$ docker build --no-cache --network=host -t <dockername> .