如何找出当前请求的HTTP方法?(How to find out the HTTP method of the current request?)
我不知道如何使用Mason获取HTTP头。 我只知道$ m是Mason Request Class。
I have no idea how to get the HTTP headers with Mason. I only know that $m is the Mason Request Class.
原文:https://stackoverflow.com/questions/24367038
更新时间:2022-08-18 08:08
最满意答案
它的工作原理与您的建议一致。 鉴于以下Dockerfile:
ARG base_image=alpine FROM $base_image
我可以像这样构建并获得阿尔卑斯山的形象:
docker build -t test1 .
或者像这样得到一个基于Fedora的镜像:
docker build -t test2 --build-arg base_image=fedora .
如您所说,更改基础映像会使缓存无效。
It works exactly like you have proposed. Given the following Dockerfile:
ARG base_image=alpine FROM $base_image
I can build it like this and get an Alpine based image:
docker build -t test1 .
Or like this to get a Fedora based image:
docker build -t test2 --build-arg base_image=fedora .
As you say, changing the base image would invalidate the cache.
相关问答
更多-
Docker不允许您从 Dockerfile所在的位置添加文件(在当前Dockerfile的目录或其子目录之外)。 Docker的开发团队表示这是出于“安全原因”:不允许这样做,它避免恶意Dockerfiles尝试导入您珍贵的/ etc / passwd或shadow文件,或其他人;-) 所以基本上,任何不以Dockerfile根目录开头的路径都不能在容器中添加,也不能用ADD和COPY添加。 请注意,符号链接不会更好。 Docker does not allow you to ADD files out ...
-
不可能。 图像已经构建(使用默认值)。 您可以编写一个快速脚本来构建自己的jenkins图像(传递args),然后从中构建子图像。 It's impossible. The image is already built (using the defaults). You could write a quick script to build your own jenkins image (passing the args) then build your sub-image from that.
-
首先,您需要使用ARG命令使用dockerfile中的build-arg。 FROM alpine # consume the build arg ARG somename # persist the env variable in the built image ENV somename=$somename # somename will appear as an env variable RUN echo $somename RUN env 并运行构建命令docker buil ...
-
我的困惑是因为错误信息实际上来自Docker,而不是Jenkins。 如果您没有指定构建上下文(如上面的文档中所述),Docker会发出此错误。 该修补程序只是添加. 到每个例子的args参数的末尾,例如: node { docker.build("foo", "--build-arg x=y .") } 请参阅docker:“build”需要1个参数。 参见'docker build --help' My confusion was because the error message is actu ...
-
使用--build-arg在Docker镜像中修改FROM子句(Using --build-arg to modify FROM clause in Docker image)[2023-05-13]
它的工作原理与您的建议一致。 鉴于以下Dockerfile: ARG base_image=alpine FROM $base_image 我可以像这样构建并获得阿尔卑斯山的形象: docker build -t test1 . 或者像这样得到一个基于Fedora的镜像: docker build -t test2 --build-arg base_image=fedora . 如您所说,更改基础映像会使缓存无效。 It works exactly like you have proposed. Gi ... -
Docker build-arg和copy(Docker build-arg and copy)[2022-08-09]
在使用之前,您需要在Dockerfile使用ARG定义它: FROM alpine:3.3 ARG folderVariable=./my-folder # Optional default value to be `./my-folder` COPY ${folderVariable} /opt/my-folder 建立它像: docker build --build-arg folderVariable=./folder-copy -t test . 更多细节请参考: https : //git ... -
我最终只是去调用命令行的路线 Target "BuildDocker" (fun _ -> trace "Building Docker Image" let result = ExecProcess (fun info -> info.FileName <- ("Docker.exe") info.Arguments <- ("build -t \"docker/api:develop\" ." ) info.WorkingDirectory <- ...
-
可悲的是,目前尚未支持此功能。 我们现在所有的码头工具都是神奇的整合。 这里有几个选项,但它们都不是你想要的。 您可以在本地构建docker容器,将其推送到gcr.io,然后在gcloud app deploy上使用--image-url标志。 在接下来的几周内,我们将默认开始使用我们的容器构建器服务来实现具有托管虚拟机的docker构建。 虽然我们现在没有计划来公开设置,但是有一个配置设置允许您通过容器构建器API定义环境变量 。 将来更容易支持这样的事情。 希望这可以帮助! Sadly, this is ...
-
经过一番调查,我意识到我的基本图像是问题,我正在使用: mhart/alpine-node:6.9.1 切换到 kkarczmarczyk/node-yarn 做了伎俩。 我想Alpine节点很小,并且正在删除对代理/网络配置很重要的东西 After some investigation I realised that my base image was the problem, I was using: mhart/alpine-node:6.9.1 Switching to kkarczmarczyk/ ...
-
ARG不用于插入ENTRYPOINT。 要实现您想要的功能,您可以使用ENV HOST $HOST添加一行。 然后,入口点将在运行时使用$ HOST,而不是在构建时使用内插值,但是,变量将使用在构建时设置的默认值进行设置,但仍然可以覆盖。 这是一个例子: $ cat Dockerfile FROM busybox ARG what ENV what $what RUN echo ${what} > /tmp/${what} ENTRYPOINT cat /tmp/${what} $ docker run ...