简体   繁体   English

在Windows 10 linux映像中的Docker绑定挂载问题

[英]Docker bind mount issue in windows 10 linux image

I have an issue where docker doesn't sync up with my file change, Even though I have enabled shared volumes and added bind mount. 我有一个问题,即docker无法与我的文件更改同步,即使我已启用共享卷并添加了bind mount。

My current system Windows 10 pro Docker version 18.09.2, build 6247962 我目前的系统是Windows 10 pro Docker版本18.09.2,内部版本为6247962

error message while docker build docker build时的错误消息

SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. 安全警告:您正在针对非Windows Docker主机从Windows构建Docker镜像。 All files and directories added to build context will have '-rwxr-xr-x' permissions. 添加到构建上下文的所有文件和目录都具有“-rwxr-xr-x”权限。 It is recommended to double check and reset permissions for sensitive files and directories. 建议仔细检查并重置敏感文件和目录的权限。

This is for a windows 10 machine, I've tried with the following file. 这是一个Windows 10机器,我尝试过以下文件。

FROM node:8.11 FROM节点:8.11

RUN mkdir /usr/src/app
WORKDIR /usr/src/app
COPY package*.json ./
COPY yarn.lock ./
RUN yarn
COPY . .

docker-compose.yml
version: '3'
services:
  app_web:
    build: .
    ports:
      - "80:4000"
    volumes:
      - .:/usr/src/app/
      - /usr/app/node_modules

Thats a standard warning message for docker/windows and doesn't imply error. 这是docker / windows的标准警告消息,并不意味着错误。

For your case, use absolute host path in docker compose file instead of "." 对于您的情况,请在docker compose文件中使用绝对主机路径而不是“。”。 and see if that works. 并看看是否有效。 Also, you will need to enable drive sharing first from docker for windows menu. 此外,您需要首先从docker for Windows菜单启用驱动器共享。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM