docker - Docker 卷集但代码不更新代码
问题描述
我正在构建的 django 应用程序有以下 Dockerfile
# base image to be used
FROM python:3.6
# The enviroment variable ensures that the python output is set straight
# to the terminal with out buffering it first
ENV PYTHONUNBUFFERED 1
# create root directory for our project in the container
#RUN mkdir /code
# Set the working directory to the created dir
WORKDIR /code
# add the requiremnets file to the working dir
COPY requirements.txt /code/
#instal the requirements (install before adding rest of code to avoid rerunning this at every code change-built in layers)
RUN pip3 install -r requirements.txt
# Copy the current directory contents into the container at /music_service
COPY . /code/
#set environments to be used
ENV AUTHOR="Mokgadi Rasekgala "
EXPOSE 8000
VOLUME /code
#run the service docker app
CMD /code/start.sh
当我构建文件并使用以下命令运行它时
docker run -it -p 8000:8000 <image>
该卷似乎没有安装在 /code 目录上
我也尝试运行它
docker run -it -v my-vol:/code -p 8000:8000 <image>
但也仍然无法识别我在没有首先构建的情况下对视图所做的更改
因为我在如何定义音量方面缺少一些东西。我正在尝试使更改可见,而无需再次构建和运行
解决方案
推荐阅读
- amazon-web-services - 为什么在具有 Deny 效果的 Bucket 策略中将委托指定为 NotPrincipal 时委托给 Account 不起作用?
- c++ - 通过使用 eglExportDMABUFImageQueryMESA 和 GL_RGBA(A 结束)在两个应用程序之间的纹理共享问题
- html - 如何在手机屏幕上更改网站项目的顺序
- docker - docker-compose 容器之间的连接
- google-api - 如何在 Google Photos API 中为媒体项目添加定位丰富?
- javascript - Javascript - 当值为...时更改表格中的文本颜色
- node.js - 将 Node.js 与 React 连接起来
- python - 我不断收到错误名称'y_test'未定义
- sql - Laravel 模型在托管后使用 id = 0 创建
- c - execvp() 不会加载文件:“没有这样的文件或目录”