Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

docker_container.ubuntu: Unable to start container: API error (400): #15

Closed
hashibot opened this issue Jun 13, 2017 · 6 comments
Closed
Labels
Milestone

Comments

@hashibot
Copy link

hashibot commented Jun 13, 2017

This issue was originally opened by @maks-us as hashicorp/terraform#15141. It was migrated here as part of the provider split. The original body of the issue is below.


Hi there,

Terraform Version

Terraform v0.9.6
Mac OS 10.12.5
Docker version 17.06.0-ce-rc1, build 7f8486a

Affected Resource(s)

resource "docker_container" "ubuntu"
resource "docker_image" "ubuntu"

It is example from this page https://www.terraform.io/docs/providers/docker/r/container.html

Debug Output

Error applying plan:
1 error(s) occurred:

  • docker_container.ubuntu: 1 error(s) occurred:
  • docker_container.ubuntu: Unable to start container: API error (400): {"message":"starting container with non-empty request body was deprecated since v1.10 and removed in v1.12"}

Expected Behavior

work example from the documentation website

Actual Behavior

start ubuntu container

Steps to Reproduce

  1. create main.tf
  2. add content:
resource "docker_container" "ubuntu" {
  name  = "foo"
  image = "${docker_image.ubuntu.latest}"
  command = ["top"]
}

resource "docker_image" "ubuntu" {
  name = "ubuntu:precise"
}
  1. run:
    terraform apply
@hashibot hashibot added the bug label Jun 13, 2017
@mavogel mavogel added this to the v1.1.1 milestone Oct 30, 2018
@mavogel mavogel modified the milestones: v1.1.2, v1.1.3 Apr 24, 2019
@mavogel mavogel modified the milestones: v2.1.0, v2.x.x Jul 1, 2019
@dubo-dubon-duponey
Copy link
Contributor

Apologies for the noise/previous comment 🤦‍♂️

This is just working fine (unable to reproduce), and the original bug may have been fixed (some of the logs are still confusing, but that would be a different issue).

@mavogel
Copy link
Contributor

mavogel commented Oct 8, 2019

No worries @dubo-dubon-duponey :) Thank you for contributing. Which logs are still confusing? Do you have an example?

@mavogel mavogel modified the milestones: v2.x.x, v2.5.0 Oct 8, 2019
@dubo-dubon-duponey
Copy link
Contributor

I'm using multiple docker-nodes in the same terraform project.

When testing the above, I mistakenly forgot to specify the provider for the docker_image resource:

resource "docker_image" "ubuntu" {
  name = "ubuntu:bionic"
}

resource "docker_container" "ubuntu" {
  provider = docker.something
  name  = "foo"
  image = docker_image.ubuntu.latest
}

... which means that the image itself was pulled on my laptop, while the container tried to start on a different node ("something").

The error message you get in that case is as follow:

Error: Unable to create container with image sha256:2ca708c1c9ccc509b070f226d6e4712604e0c48b55d7d8f5adc9be4a4d36029a: Unable to pull image sha256:2ca708c1c9ccc509b070f226d6e4712604e0c48b55d7d8f5adc9be4a4d36029a: error pulling image sha256:2ca708c1c9ccc509b070f226d6e4712604e0c48b55d7d8f5adc9be4a4d36029a: Error response from daemon: pull access denied for sha256, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

This is confusing indeed, as this is typically what you get if you typo the image name or are not logged-in into the hub - which is definitely not the situation here.

@mavogel
Copy link
Contributor

mavogel commented Oct 25, 2019

Hmm, TBH I don't think we can catch those configuration errors. What would you suggest @dubo-dubon-duponey ? Wait for hashicorp/terraform-plugin-sdk#61 as well?

@dubo-dubon-duponey
Copy link
Contributor

Yeah. That's minor either way.

@dubo-dubon-duponey
Copy link
Contributor

And as far as this ticket is concerned, I couldn't reproduce and probably got fixed some time ago.

@mavogel mavogel closed this as completed Oct 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants