我在 docker-compose.yml 中定义了一个卷。我想使用 Dockerfile 中卷中的这些文件之一,但收到错误:“没有这样的文件或目录”
如果我创建容器时无法访问 Dockerfile 中的文件,我将在 docker-compose.yml 文件的特定位置看到容器内卷中的所有文件。
这是它应该如何工作还是我做错了什么?我想我错过了一些东西。
存储库: https: //github.com/Lightshadow244/OwnMusicWeb
docker-compose.yml:
version: '3'
services:
ownmusicweb:
build: .
container_name: ownmusicweb
hostname: ownmusicweb
volumes:
- ~/OwnMusicWeb/ownmusicweb:/ownmusicweb
ports:
- 83:8000
tty: true
Run Code Online (Sandbox Code Playgroud)
Dockerfile:
FROM ubuntu:latest
WORKDIR /ownmusicweb
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "python-pip"]
RUN ["pip", "install", "--upgrade", "pip"]
RUN ["pip", "install", "Django", "eyeD3", "djangorestframework", "markdown", "django-filter"]
RUN ["python", "/ownmusicweb/manage.py", "migrate"]
RUN ["python", "/ownmusicweb/manage.py", "runserver", "0.0.0.0:8000"]
Run Code Online (Sandbox Code Playgroud)