且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

基于映像构建Docker卷

更新时间:2022-11-05 15:22:54

我不确定您是否真的需要对JS文件进行泊坞处理。相反,您可以做的是将传入流(即JS)写入另一个文件,例如volume-creator.js,然后调用该文件。

I am not sure if you really need to dockerize the JS file. Rather what you can do is write the incoming stream (which is JS) to another file e.g. volume-creator.js and then call that file.

在这种情况下,您的volume-creator.js还应包含诸如node-docker之类的依赖项,这将使您的docker命令更容易

In this case your volume-creator.js should also include dependencies like node-docker which will make your docker commands easy and OS agnostic.

我避免对调用方JS进行泊坞的原因是,您可能需要一些额外的特权才能在容器内运行docker命令,例如,可能需要挂载docker可以使您的主机OS和docker系统易受攻击的套接字。

The reason I would avoid dockerizing the invoker JS is you may need some extra privileges to run docker commands within the container e.g you may need to mount the docker socket which can make your host OS and docker system vulnerable .