将Docker与Python一起使用会显示加载libpython3.8.so.1.0时出错

将Docker与Python一起使用会显示加载libpython3.8.so.1.0时出错,python,linux,docker,ubuntu,docker-compose,Python,Linux,Docker,Ubuntu,Docker Compose,我正在做一个烧瓶项目,第二天我启动电脑时,它就不再运行了。我试着重新安装Docker,甚至重新安装我的操作系统(Ubuntu),这个错误仍然出现在一个基本的Hello World Python项目示例中。以下是尝试构建一个简单的Hello World项目的结果: # docker build -t hello-world . Sending build context to Docker daemon 4.608kB Step 1/6 : FROM python:3.8 ---> 65

我正在做一个烧瓶项目,第二天我启动电脑时,它就不再运行了。我试着重新安装Docker,甚至重新安装我的操作系统(Ubuntu),这个错误仍然出现在一个基本的Hello World Python项目示例中。以下是尝试构建一个简单的Hello World项目的结果:

# docker build -t hello-world .
Sending build context to Docker daemon  4.608kB
Step 1/6 : FROM python:3.8
 ---> 659f826fabf4
Step 2/6 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 5e381e0b49f2
Step 3/6 : COPY requirements.txt ./
 ---> Using cache
 ---> 4d46722cff64
Step 4/6 : RUN pip install --no-cache-dir -r requirements.txt
 ---> Running in 305e14db0fa2
/usr/local/bin/python: error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object file: No such file or directory
The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 127
Dockerfile:

FROM python:3.8

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./run.py" ]
run.py

print("Hello World")

并且requirements.txt为空。它昨天还在工作,我一直在努力弄清楚它为什么现在不工作。

使用apt而不是snap安装Docker为我修复了它。

请共享requirements.txt。对于这个示例,它是空的。您是如何安装Python 3.8的,你是如何安装Docker的?我使用snap在Ubuntu上安装Docker,据我所知,Docker通过Docker build安装Python 3.8(在Docker文件中指定)。我还看到一些关于snap安装的Docker工作不好的抱怨,尽管更多的抱怨是“权限被拒绝”类型错误(例如)。用APT而不是snap重新安装Docker是否改善了情况?