简体   繁体   中英

How to develop node.js apps with docker on Windows?

I am developing a nodejs app using windows 10 WSL with remote container in visual studio code. What are the best practices for Dockerfile and docker-compose.yml at this time?

Since we are in the development phase, we don't want to COPY or ADD the program source code in the Dockerfile (it's not practical to recreate the image every time we change one line). I use docker compose to bind the folder with the source code on the windows side with volume, but in that case, the source code folder and the set of files from the Docker container will all have Root permission.

In the Docker container, node.js runs as node general user. For the above reasons, node.js will not have write permission to the folders you bind.

Please let me know how to solve this problem.

I found a way to specify UID or GUID, but I could not specify UID or GID because I am binding from windows.

You can optionally mount Node code using NFS in Docker-compose

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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