微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何查看Docker容器基目录下的dot文件隐藏文件

如何解决如何查看Docker容器基目录下的dot文件隐藏文件

我在 Centos 7 上的 Docker 容器中的 CommandBox 中运行了一个 lucee 应用程序。

Docker version 1.13.1,build 0be3e21/1.13.1
CentOS Linux release 7.9.2009 (Core)
CommandBox v5.2.1+00295
lucee 5.3.7.47

应用程序代码在启动时通过 Dockerfile 复制到 /app 目录:

copY . /app

我想查看 /app 目录 /app/.build 中的一个文件(隐藏文件)。

如果我浏览到 http://app_name.com/.build,我会收到 404 错误(未找到)。

如果我通过以下命令将文件重命名为 build.json:

cp .build build.json

然后我可以通过 http://app_name.com/build.json 查看它

我尝试在 server.json 文件中输入以下条目:

"rewrites":{
    "enable":true,"config":"customrewrites.xml"
},

以及 customrewrites.xml 文件中的以下规则:

<rule>
    <from>\.build$</from>
    <set type="content-type">text-html</set>
    <to last="true">\.build</to>
</rule>

为了更清晰,添加完整的 Dockerfile:

FROM ortussolutions/commandBox
copY . /app
copY ./config/ /config/
ENV lucee_EXTENSIONS D4EDfdbD-A9A3-E9AF-597322D767E0C949;name=Oracle;version=11.2.0.4
workdir $APP_DIR
RUN Box install

经过进一步调查,我发现问题似乎是启动时没有创建/usr/local/lib/serverHome/WEB-INF/urlrewrite.xml文件。启动期间的日志表明正在读取重写: --urlrewrite-enable true --urlrewrite-file /app/customrewrites.xml

解决方法

我发现 Commandbox 5.2 中默认的 urlRewrite.xml 文件具有以下阻止隐藏文件的代码:

<rule>
    <condition type="request-uri" operator="equal">.*/\..*</condition>
    <from>^/(.+)$</from>
    <set type="status">404</set>
    <to type="passthrough" last="true">/404.html</to>
</rule>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。