无法使用入口点脚本运行任何容器 [英] Can't run any container with an entrypoint script

查看:239
本文介绍了无法使用入口点脚本运行任何容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每天都与docker合作,但是今天早晨,当我尝试启动一些容器时,使用入口点脚本的每个容器都失败了:

I work with docker on a daily basis, but this morning, when I tried to launch some containers, it failed for every of my containers with an entrypoint script:

$ docker run postgres:11
bash: /usr/local/bin/docker-entrypoint.sh: Permission denied

$ docker run mysql:5
/bin/bash: /usr/local/bin/docker-entrypoint.sh: Permission denied

$ docker run php:7.3-apache
/bin/sh: 0: Can't open /usr/local/bin/docker-php-entrypoint

我设法 docker运行hello-world 没有错误。

会发生什么?自上次运行以来,我认为我的计算机上没有任何重要更改。我使用的是Ubuntu 20.04。
感谢您的帮助。

What happens? I don't think I have changed anything important on my computer since the last time it worked... I am on Ubuntu 20.04. Thanks for your help.

更新

我仍然不不知道发生了什么事。我设法通过删除 docker-ce 并重新安装它来使其再次工作:

I still don't know what was going on. I managed to make it work again by removing docker-ce and re-installing it:

sudo apt-get remove docker-ce
sudo apt install docker-ce
docker run postgres:11
  ==> ok, worked!

但是,每次我关闭笔记本电脑然后打开笔记本电脑时,我又遇到了同样的问题,docker不会运行带有入口点的任何容器。

But, each time I shut down my laptop and then turn it on, I have the same problem again, docker doesn't run any container with an entrypoint.

有什么想法吗?

推荐答案

遵循@的想法PieterBeyens,我检查了Apparmor,的确,它拒绝了我对 /usr/local/bin/docker-entrypoint.sh 的读取权限。似乎我还混合安装了docker和docker-compose的snap / apt。一团糟。

Well, following the idea of @PieterBeyens, I checked apparmor, and indeed,it was denying me read access to /usr/local/bin/docker-entrypoint.sh. It also appeared that I had a mixed snap/apt installation of docker and docker-compose. It was a mess.

因此,对于将来的读者来说,我所做的工作以及最终的工作(您可能需要适应,但您有基本的想法):

So, for future readers, what I did and finally worked (you may need to adapt, but you have the general idea):

# Remove the docker and docker-compose snaps
sudo snap remove docker-compose 
sudo snap remove docker
# Remove the packages via apt
sudo apt-get purge -y  docker-ce docker-ce-cli containerd.io
# Remove the apparmor profiles (snap ones for docker)
sudo aa-remove-unknown
# Reinstall via apt
sudo apt-get install docker-ce=5:19.03.8~3-0~ubuntu-bionic docker-ce-cli=5:19.03.8~3-0~ubuntu-bionic containerd.io

我也通过curl重新安装 docker-compose

这篇关于无法使用入口点脚本运行任何容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆