Spring boot Spring引导停靠应用程序在主机中创建文件
我有spring boot应用程序,在docker内部运行。 现在,我正在SpringBoot中使用Spring boot Spring引导停靠应用程序在主机中创建文件,spring-boot,docker,docker-machine,Spring Boot,Docker,Docker Machine,我有spring boot应用程序,在docker内部运行。 现在,我正在SpringBoot中使用 File file = new File("/var/www/html"); File f = new File(file, System.currentTimeMillis() + ".jpg"); 我想公开访问这个文件,所以必须在var/www/html文件夹中创建 但这样做,我无法看到var/www/html中的任何文件,因为应用程序正在docker容器中运行。 如何更改Docker容器
File file = new File("/var/www/html");
File f = new File(file, System.currentTimeMillis() + ".jpg");
我想公开访问这个文件,所以必须在var/www/html文件夹中创建
但这样做,我无法看到var/www/html中的任何文件,因为应用程序正在docker容器中运行。
如何更改Docker容器卷,以便在主机中创建上述位置的文件?运行Docker映像时,您需要装入卷 如果通过执行docker run命令来运行docker映像,请在命令中添加以下内容:
码头工人跑
-v/var/www/html:/var/www/html
..这是正确的命令吗?因为对于volumtag:docker run-v:where是错误的?我补充说。。。意味着你的另一个论点不起作用。。不应该使用容器路径?在命令中都是相同的/var/www/html..docker run--restart always--name test-v/var/www/html:/var/www/html-d-p 82:82 test您在这个位置向docker用户授予权限了吗?