14

On running docker-compose stop it fails to stop the docker images, and gives an error like this:

ERROR: for nginx cannot stop container: 5f5ed6d2110a0d845508ede160d8196d3e01f1d677e22e4944adc8c984800cff: Cannot kill container 5f5ed6d2110a0d845508ede160d8196d3e01f1d677e22e4944adc8c984800cff: Unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "Permission Denied": unknown

The images are still running properly, they just don't restart. I am running docker-compose on Ubuntu.

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
Rijo Simon
  • 777
  • 3
  • 15
  • 35

5 Answers5

20

I was able to work around the problem by running:

sudo killall docker-containerd-shim

And then docker-compose down started working for me.

I found the solution in this bug report, and it seems that it involves a backport of a fix to the runc code.

EDIT

It seems that the root cause of these problems on my system was the Docker snap image on my Ubuntu 18.04 installation. I completely removed the snap image and reinstalled Docker using https://get.docker.io, and I no longer encounter these problems. In the meantime, the rest of my answer above worked for me as a workaround.

Eddy R.
  • 1,089
  • 7
  • 12
  • 12
    I think it's now `containerd-shim`, at least in my version. – serkef Dec 26 '18 at 11:35
  • Also check https://stackoverflow.com/questions/49104733/docker-on-ubuntu-16-04-error-when-killing-container/49573618#49573618. Eddy's solution worked for me in 18.10 as well. snap remove docker. – serkef Dec 28 '18 at 21:20
  • Confirmed, docker installed through snap is known to have some quirks and issues that do not affect other installation methods. I was also getting the "permission denied" error and had to rip out docker engine and docker compose. I got things to work by reinstalling the engine using the link below, and then using the docker compose plugin. https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository – Victor Jul 19 '23 at 23:22
19

Somehow this worked for me.

$ sudo killall containerd-shim
Zoe
  • 27,060
  • 21
  • 118
  • 148
Mr Mayur
  • 571
  • 6
  • 9
9

2021: in my case, I am using the

sudo aa-remove-unknown

then, run

sudo docker-compose down

then, the application down successfully

0

I had the same problem and what helped me was to kill all of my containers, delete all of my images and data volumes, and start over.

If you have no problem DELETING all of your data volumes and all of your unused images, you can try these two commands:

sudo service docker restart
docker system prune --all --volumes
ezkl
  • 3,829
  • 23
  • 39
Eli
  • 27
  • 2
0

There is such a solution.
Stop and restart docker services

sudo systemctl stop docker.socket
sudo systemctl stop docker
sudo systemctl restart docker

After check -> docker ps
if cant be deleted to containers then try this -> docker container rm container_name --force

Ports may not have been deleted. this will cause conflict.
Find used port PID -> sudo lsof -i:port and kill sudo kill -9 PID