Problems starting docker instance

1.7k Views Asked by At

Not sure this is a docker problem specifically but this is how it goes: I tried sudo docker stop 7f8c9285465c which resulted in

Error response from daemon: cannot stop container: 7f8c9285465c: Cannot kill container...unknown error after kill: runc did not terminate sucessfully: container_linux.go:392: signaling init process caused "permission denied"

Following this stackoverflow suggestion I did sudo aa-remove-unknown. Now the docker stop succeeded but subsequent docker-compose up resulted in:

snap-confine has elevated permissions and is not confined but should be. Refusing to continue to avoid permission escalation attacks.

Next I ran the command sudo apt purge snapd snap-confine && sudo apt install -y snapd. Now running docker-compose up results in

bash: /snap/bin/docker-compose: No such file or directory.

The command sudo docker container ls results in:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

sudo service docker status returns Active: active (running).

I tried reinstalling docker. running sudo docker run hello-world retunrs the same Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (although status is active) .

2

There are 2 best solutions below

0
On

Create file /etc/systemd/network/bridge.network with contents:

[Network]

IPFoward=kernel

If no permissions to save do so in root mode (sudo su -).

Then, run:

sudo systemctl restart systemd-networkd.service # (disconnected network)
sudo apt remove docker-ce # If you hadn't done so before
sudo apt install docker-ce # Should start docker.service
sudo systemctl status docker.service  # Verify docker.service is running

This information has been taken from this docker forum discussion.

0
On

I think you installed docker with snap and installation of snapd is not complete "snap-confine has elevated permissions and is not confined but should be. Refusing to continue to avoid permission escalation attacks.

" this error indicates that "apparmor" service is not enabled.

 sudo systemctl enable --now apparmor
 sudo systemctl status apparmor

If apparmor is not installed install it:

  sudo apt-get install apparmor

this error "bash: /snap/bin/docker-compose" indicates that "/snap/bin" is not in your PATH. if you run this snap --version you might get an error saying "/snap/bin" is not in PATH.

sudo nano /etc/environment

Add "/snap/bin"

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/snap/bin

Now you need to restart your system. Everything should be fixed.