I am trying to start some containers using terraform, pulling those from my own registry but just can't get past the pinging docker server validation, where I get a fugly: * Error pinging Docker server: API error (404): 404 page not found
error.
For better explaining this, I started the registry as docker documentation points out; afterwards pushed an image and tried to apply a very basic .tf
configuration using terraform:
docker.tf
# set provider to local registry
provider "docker" {
host = "http://docker.localhost.com:5000/v2/ubuntu"
}
# create container
resource "docker_container" "test" {
image = "latest"
name = "test"
}
I can pull the manifests and the images using a URL like: http://docker.localhost.com:5000/v2/ubuntu/_manifests/latest
without much of a problem but when running terraform things go south and all I get is an error.
Checking the registry logs I see this when I run terraform:
`172.*.*.1 - - [04/Apr/2016:18:30:28 +0000] "GET /v2/ubuntu/_ping HTTP/1.1" 404 19 "" "go-dockerclient"`
Tried the same manually using CURL and had a look at the API docs but can't find anywhere _ping
being implemented so at this point all I'd ask for is a way to bypass this check. Is there a way to do it?
I have no authentication set so far, so this (I believe) is no authentication BS... yet.
答案 0 :(得分:0)
docker提供程序中的docker主机指向Docker守护程序而不是docker注册表。
terraform内部使用的go-dockerclient
点击了Docker远程API的此终点 - https://docs.docker.com/engine/reference/api/docker_remote_api_v1.20/#ping-the-docker-server
要从注册表中提取,您必须执行以下操作:
resource "docker_container" "test" {
image = "docker.localhost.com:5000/org/some-image:latest"
name = "test"
}