首页 \ 问答 \ 如何找出当前请求的HTTP方法?(How to find out the HTTP method of the current request?)

如何找出当前请求的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 ...
  • 它的工作原理与您的建议一致。 鉴于以下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 ...
  • 在使用之前,您需要在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 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)