-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creation of docker container failed (python image) #595
Comments
For next time, please add version of terraform, use syntax highlighting it really helps to read code an minify the potential bug example. TLDR Longer I could reproduce the behaviour, but it starts with the config of your example. The example tries to start a container See
Lets have a look at the healthcheck in the image (executed by the container):
No healthcheck as it would be implemented it according to https://docs.docker.com/engine/reference/builder/#healthcheck So lets recheck it with a proper healthcheck: main.tf resource "docker_image" "ubuntu" {
name = "python:latest"
keep_locally = true # convinience for iterations
}
resource "docker_container" "container" {
image = docker_image.ubuntu.image_id
name = "ubuntu1e-${replace(timestamp(),":","")}" # unique name for iterations
wait = true
tty = true # need to use interactive container, very unusual
healthcheck {
interval = "1s"
start_period = "1s"
retries = 1
test = [ "CMD", "/bin/true"]
}
} this results in no crash with this output:
IMHO: no one would use an interactive container u did, this is bleeding edge or hacking around ;). |
code: -
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
}
}
provider "docker" {
host = "unix:///var/run/docker.sock"
}
resource "docker_image" "ubuntu" {
name = "python:latest"
}
resource "docker_container" "container" {
image = docker_image.ubuntu.image_id
name = "ubuntu1e"
wait = true
}
resource "docker_network" "private_network" {
name = "inet2"
driver = "bridge"
}
error: -
docker_container.container: Creating...
╷
│ Error: Plugin did not respond
│
│ with docker_container.container,
│ on Docker_Create_Container_Main.tf line 1, in resource "docker_container" "container":
│ 1: resource "docker_container" "container" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-docker_v3.0.2 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc5b6f7]
goroutine 16 [running]:
github.com/terraform-providers/terraform-provider-docker/internal/provider.resourceDockerContainerCreate.func1(0x7?)
github.com/terraform-providers/terraform-provider-docker/internal/provider/resource_docker_container_funcs.go:508 +0x1b7
created by github.com/terraform-providers/terraform-provider-docker/internal/provider.resourceDockerContainerCreate
github.com/terraform-providers/terraform-provider-docker/internal/provider/resource_docker_container_funcs.go:521 +0x2b6e
Error: The terraform-provider-docker_v3.0.2 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
The text was updated successfully, but these errors were encountered: