如何在自制软件中安装特定版本的公式?例如,postgresql-8.4.4而不是最新的9.0.
在容器内运行服务时,让我们说命令是mongodb
docker run -d myimage
Run Code Online (Sandbox Code Playgroud)
将立即退出,并返回容器ID.在我的CI脚本中,我在运行mongo容器后立即运行客户端来测试mongodb连接.问题是:客户端无法连接,因为服务尚未启动.除了sleep 10
在我的脚本中添加一个大的,我没有看到任何等待容器启动和运行的选项.
Docker有一个wait
在这种情况下不起作用的命令,因为容器不存在.这是码头工人的限制吗?谢谢
有人可以解释这里发生了什么吗?
package main
import (
"fmt"
"net/http"
"strings"
)
func Verify(req http.Request) string {
return req.FormValue("g-recaptcha-response")
}
func main() {
req, _ := http.NewRequest("POST", "http://www.google.com/search?q=foo&q=bar&both=x&prio=1&empty=not",
strings.NewReader("z=post&both=y&prio=2&empty="))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
Verify(*req)
fmt.Println(req.FormValue("z"))
}
Run Code Online (Sandbox Code Playgroud)
( https://play.golang.org/p/ve4Cc_JTzr )
这将产生一个空输出。现在,如果我在将请求作为值传递之前访问值“z” ,它就起作用了!
package main
import (
"fmt"
"net/http"
"strings"
)
func Verify(req http.Request) string {
return req.FormValue("g-recaptcha-response")
}
func main() {
req, _ := http.NewRequest("POST", "http://www.google.com/search?q=foo&q=bar&both=x&prio=1&empty=not",
strings.NewReader("z=post&both=y&prio=2&empty="))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
Verify(*req)
fmt.Println(req.FormValue("z"))
}
Run Code Online (Sandbox Code Playgroud)
( https://play.golang.org/p/5ALnt-pHTl )
我尝试了从 1.5 到 1.7 的多个版本,但结果都一样奇怪。如果请求是通过引用传递的,它会按预期工作。