我有一个Dockerfile,用于创建开发容器。它在我的Mac上运行正常,但我在Windows上的同事却没有安装本地开发目录。当他通过bash进入容器时,它显示一个空目录。好像没有挂载本地目录。我们应该为Windows专门做些什么吗?
这是我的Dockerfile,它位于项目的根目录
FROM node:alpine
RUN apk update
RUN apk add nano bash bash-completion
# Set Working Directory
WORKDIR /var/www/api
COPY . .
ENV ENV="/root/.bashrc"
RUN echo 'alias ll="ls -lhat"' >> /root/.bashrc
RUN echo 'export PS1="\[\e[0;32m\][MM_PLAY] \w\$\[\e[0m\] "' >> /root/.bashrc
CMD ["node", "./bin/www"]
docker-compose文件
version: '3.2'
services:
api:
build: ../../
ports:
- "1337:1337"
- "7331:7331"
volumes:
- type: bind
source: ../../
target: /var/www/api
command: bash
#command: yarn start
stdin_open: true
tty: true
container_name: mm
networks:
default:
external:
name: database_default
答案 0 :(得分:0)
事实证明,您必须执行一些额外步骤才能使卷在Windows上运行:https://rominirani.com/docker-on-windows-mounting-host-directories-d96f3f056a2c