Various Docker Container Paths Have Started Failing with Permission Errors on Linux Mint

Various Docker container paths have started failing with permission errors on Linux Mint

This problem was quite hard to track down, as there does not seem to be much information about for it. My sense is that it affects Docker only in Snap, and not Docker installed in other ways. The problem is discussed in this forum thread.

The problem stems from a buggy kernel, in my case 5.3.0-53, and dropping back down to the previously installed version solves the problem. For me that is 5.3.0-51. This bug report indicates that the problem is also exhibited in 5.4.0-31, and that can be fixed by dropping back to 5.4.0-29. This explains how the problem manifested on its own - a new kernel was delivered via a system update.

I used this answer to amend Grub so it boots into an older kernel. Here are the steps to take for readers with the same issue:

List your currently kernels, so you can identify the previously installed kernel:

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}'

Confirm which kernel is the problem:

uname -r

You will need to change the boot option in /etc/default/grub, specifically a value called GRUB_DEFAULT. This is normally 0 to mean "boot latest kernel":

GRUB_DEFAULT=0

You need to change this so it points to a specific kernel. My value is thus:

GRUB_DEFAULT="Advanced options for Linux Mint 19.3 Cinnamon>Linux Mint 19.3 Cinnamon, with Linux 5.3.0-51-generic"

These are menu strings, which we're asking Grub to auto-select for us. To discover what yours are, have a look in /boot/grub/grub.cfg, and search for the keyword submenu to find the top-level element, i.e. "Advanced options for Linux Mint 19.3 Cinnamon" in this case. From that point, search for menuentry to find the second-level element, which is "Linux Mint 19.3 Cinnamon, with Linux 5.3.0-51-generic" in this case. There are many submenus - you need the version for the penultimate version of the kernel.

Add these two string together, put a > between them, wrap them in quotes, and use that as your GRUB_DEFAULT value. As per the useful answer I linked to earlier, it is sensible to take a backup of your Grub file before rebooting, in case you get something wrong:

sudo cp /etc/default/grub /etc/default/grub.bak

Finally, you should regen the Grub menu after your changes:

sudo update-grub

Once you reboot, you should find that Docker is back to normal. It is to be hoped that a new kernel will be released, at which point Grub will need to be manually switched back to track the latest version (assuming it shall be fixed in the next Linux release).

How to fix docker: Got permission denied issue

If you want to run docker as non-root user then you need to add it to the docker group.

  1. Create the docker group if it does not exist
$ sudo groupadd docker

  1. Add your user to the docker group.
$ sudo usermod -aG docker $USER

  1. Log in to the new docker group (to avoid having to log out / log in again; but if not enough, try to reboot):
$ newgrp docker


  1. Check if docker can be run without root
$ docker run hello-world

Reboot if still got error

$ reboot

Warning

The docker group grants privileges equivalent to the root user. For details on how this impacts security in your system, see Docker Daemon Attack Surface..

Taken from the docker official documentation:
manage-docker-as-a-non-root-user

Docker error in Linux mint 17

I don't know how it comes with .deb package (I'm using Fedora), but TLS shouldn't be set by default, so I would suggest following some basic steps to see if it is running correctly.

1. Check if docker daemon is running

ps aux | grep docker
root 4215 0.1 0.1 440156 17332 ? Ssl 15:48 0:00 /usr/bin/docker -d -D --bip=172.17.42.1/16 --dns=172.17.42.1 --dns-search=docker -s overlay
wololock 8986 0.0 0.0 113024 2304 pts/1 S+ 15:50 0:00 /usr/bin/grep docker

I the docker process is not running, try sudo /etc/init.d/docker start or sudo service docker start

2. Check if /var/run/docker.sock exists

ls -la /var/run/docker.*
-rw-r--r--. 1 root root 4 04-23 15:48 /var/run/docker.pid
srw-rw----. 1 root docker 0 04-23 15:48 /var/run/docker.sock

The important part here is that file need to be own by group docker, so you can connect to it without root permissions.

If docker.sock does not exist, you can try running docker from the command line with debug mode on to see what causes the problem:

sudo docker -d -D

3. Check if your user is added to docker group

id -a
uid=1000(wololock) gid=1000(wololock) grupy=1000(wololock),0(root),10(wheel),100(users),977(docker),989(pkg-build)

If you wont find your user in docker group, try adding yourself to it by:

sudo gpasswd -a [username] docker

4. Get the latest docker version

If the previous attempts wont help, try getting the latest docker version from https://docs.docker.com/installation/ubuntulinux/#installing-docker-on-ubuntu I'm not sure, but this line:

FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json:

suggests that you're using docker v1.18. I might be wrong, but if it's true, this is not the most recent docker version and it should be upgraded. I use currently docker v1.5.0, it works well on Fedora 21

IMPORTANT: UBUNTU / LINUX MINT USERS

The problem we discussed here was caused by missing (or not running) apparmor package in the ubuntu/linuxmint distribution. The easiest way to fix it is to install apparmor:

sudo apt-get install apparmor

If it's installed yet not running, start it with:

sudo service apparmor start
  • https://wiki.ubuntu.com/AppArmor
  • https://github.com/docker/docker/issues/9745

I hope my answer will help you in resolving your problem. If you have any questions, feel free to ask. I will try to help you as much as I can.

Why is Docker installed but not Docker Compose?

You also need to install Docker Compose. See the manual. Here are the commands you need to execute

sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)"  -o /usr/local/bin/docker-compose
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose

Note:
Make sure that the link pointing to the GitHub release is not outdated!. Check out the latest releases on GitHub.

standard_init_linux.go:178: exec user process caused exec format error

I forgot to put

#!/bin/bash

at the top of the sh file, problem solved.



Related Topics



Leave a reply



Submit