As part of our introduction to self-service publishing in the Terraform Registry, this copy of the provider has been archived, and ownership has been transferred to active maintainers in the community. Please see the new location on the Terraform Registry: https://registry.terraform.io/providers/kreuzwerker/docker/latest
I could be working under a wrong assumption here, but the idea was to manage multiple remote Docker hosts, each with a matching alias. When all Docker providers in the configuration have an alias, the default Docker provider configuration gets evaluated as well, which will try to connect to a local Docker daemon over the unix domain socket. Docker is not installed on the Terraform host machine.
So, with just one Docker provider in the configuration, after adding an "alias," planning fails because the connection fails.
Workarounds:
removing the alias on just one Docker provider, in order to make this the default one,
add a dummy Docker provider declaration with a real host value without alias, without resources.
Terraform Version
0.12.21
Terraform Configuration Files
provider "docker" {
alias = "docker-remote-host"
host = "ssh://user@${var.REMOTE-HOST}:22"
}
resource "docker_container" "REMOTE_HOST_API" {
name = "REMOTE_HOST_API"
...
}
Debug Output
Relevant part:
2020/02/25 11:52:34 [TRACE] buildProviderConfig for provider.docker: no configuration at all
2020/02/25 11:52:34 [TRACE] GRPCProvider: GetSchema
2020/02/25 11:52:35 [TRACE] GRPCProvider: Configure
2020/02/25 11:52:35 [ERROR] <root>: eval: *terraform.EvalConfigProvider, err: Error pinging Docker server: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
2020/02/25 11:52:35 [ERROR] <root>: eval: *terraform.EvalSequence, err: Error pinging Docker server: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
2020/02/25 11:52:35 [ERROR] <root>: eval: *terraform.EvalOpFilter, err: Error pinging Docker server: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
2020/02/25 11:52:35 [ERROR] <root>: eval: *terraform.EvalSequence, err: Error pinging Docker server: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Expected Behavior
I would have expected the same result, with or without an "alias" attribute present.
Actual Behavior
The "default" Docker provider is pulled into the evaluation, and as this one has no configuration, its host is set to the default: the local Docker daemon. The provider then proceeds by trying to connect to the local daemon, which fails because it isn't there.
Steps to Reproduce
Just add an alias to a Terraform configuration with a single Docker provider. Start a plan.
Hi,
I could be working under a wrong assumption here, but the idea was to manage multiple remote Docker hosts, each with a matching alias. When all Docker providers in the configuration have an alias, the default Docker provider configuration gets evaluated as well, which will try to connect to a local Docker daemon over the unix domain socket. Docker is not installed on the Terraform host machine.
So, with just one Docker provider in the configuration, after adding an "alias," planning fails because the connection fails.
Workarounds:
Terraform Version
0.12.21
Terraform Configuration Files
Debug Output
Relevant part:
Expected Behavior
I would have expected the same result, with or without an "alias" attribute present.
Actual Behavior
The "default" Docker provider is pulled into the evaluation, and as this one has no configuration, its host is set to the default: the local Docker daemon. The provider then proceeds by trying to connect to the local daemon, which fails because it isn't there.
Steps to Reproduce
Just add an alias to a Terraform configuration with a single Docker provider. Start a plan.