Code Monkey home page Code Monkey logo

docker-bind-mount's Introduction

Windows の Docker では共有フォルダのオーナーが root になるらしいので試してみた

フォルダを共有しない場合

docker-compose.yml

version: '3'
services:
  app:
    build: .
    tty: true
    ports:
      - 8000:8000
    # volumes:
    #   - .:/home/node/app
docker-compose build --no-cache
docker-compose up -d
docker-compose exec app bash
cd ../
ls -l

結果

$ docker-compose exec app bash
node@578b31633ba7:~/app$ cd ../
node@578b31633ba7:~$ ls -l
total 4
drwxr-xr-x 2 node node 4096  9月  4 14:52 app
node@578b31633ba7:~$

フォルダを共有する場合

docker-compose.yml

version: '3'
services:
  app:
    build: .
    tty: true
    ports:
      - 8000:8000
    volumes:
      - .:/home/node/app
docker-compose build --no-cache
docker-compose up -d
docker-compose exec app bash
cd ../
ls -l

結果

$ docker-compose exec app bash
node@fbf4b6d71ddc:~/app$ cd ../
node@fbf4b6d71ddc:~$ ls -l
total 0
drwxrwxrwx 1 root root 4096  9月  4 21:37 app
node@fbf4b6d71ddc:~$

参考

docker-library/postgres#558 (comment)

https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user


  1. Microsoft Store から Ubuntu 20.04 をインストール
  2. Docker Desktop の Dashboard から WSL INTEGRATION で Ubuntu-20.04 にチェック
  3. //wsl$/Ubuntu-20.04/home/USERNAME/workspace
    ↑をワークスペースとして使っていくことで解決しそう。

Improve container performance
https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_store-your-source-code-in-the-wsl-2-filesystem-on-windows

Developing inside a Container using Visual Studio Code Remote Development
https://code.visualstudio.com/docs/remote/containers#_open-a-wsl-2-folder-in-a-container-on-windows

Docker Desktop WSL 2 バックエンド | Docker ドキュメント
https://matsuand.github.io/docs.docker.jp.onthefly/desktop/windows/wsl/#install

docker-bind-mount's People

Contributors

yos10 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.