Docker - accessing files inside container from host

前端 未结 3 1158
余生分开走
余生分开走 2021-01-20 00:07

I am new to docker.

I ran a node-10 images and inside the running container I cloned a repository, ran the app which started a server with file watcher. I need to ac

3条回答
  •  -上瘾入骨i
    2021-01-20 00:38

    Hi I think you should use mount volumes for the source code and edit your code from your IDE normally:

    docker run -it -v "$PWD":/app -w /app -u node node:10 yarn dev
    

    here docker will create an image setting the working dir to "/app", mount the current dir to "/app" and run "yarn dev" at start up with the "node" user (none root user)

    Hope this is helpfull.

提交回复
热议问题