terraform provider + docker registry v2 = 404

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:

  • Dockerfile volume: local changes are not reflected in docker
  • Cannot start a docker container
  • Why is sbt-native-packager staging bin/start as a directory instead of a script?
  • How do I configure “ulimits” for a Docker container running in AWS ECS?
  • change docker containers IP address
  • Google Cloud Container Registry Issues while pushing docker images
  • 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 _pingbeing 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.

  • Using Docker-Compose, how to execute multiple commands
  • How to launch an app via Docker on every Pull Request?
  • Using Pillow in Docker
  • Docker non-root access: Error loading config file:stat /home/wu/.docker/config.json
  • Transparent proxying for all docker containers
  • Limit the number of exited containers on a host (1.8.3)
  • One Solution collect form web for “terraform provider + docker registry v2 = 404”

    The docker host in the docker provider points to the Docker daemon and not a docker registry.

    The go-dockerclient that terraform uses internally is hitting this endpoint of the Docker remote API – https://docs.docker.com/engine/reference/api/docker_remote_api_v1.20/#ping-the-docker-server

    To pull from your registry, you will have to do something like below:

    resource "docker_container" "test" {
        image = "docker.localhost.com:5000/org/some-image:latest"
        name = "test"
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.