Comments (7)
@efpe when I'm done with the swarm approach, I'll take a look at the other issues. No ETA atm
from terraform-provider-docker.
This is still happening with version v0.10.8
.
Workaround is to run a local-exec script from the resource:
resource "docker_container" "asd" {
[...]
networks = [ "${docker_network.net1.id}", "othernetwork" ]
provisioner "local-exec" {
command = "/usr/bin/docker network disconnect ${var.default_network_name} ${docker_container.asd.name}"
}
}
from terraform-provider-docker.
Any news on this?
from terraform-provider-docker.
@mavogel great to hear the issues is picked up :) Thanks!
from terraform-provider-docker.
Another thing I found as a work around was to put one of the networks in the "network_mode" configuration so:
networks = ["net1", "net2"]
network_mode = "net1"
This basically causes terraform to attach the container to "net1" during the creation of the container and then "attach" to the rest of the networks post-create. Doing a second "attach" when its already attached seems to be a no-op with docker.
from terraform-provider-docker.
Please see my fix 587988c in PR #92 to fix this provider bug.
from terraform-provider-docker.
as @bhuisgen denotes his commit fixes the bug 👍 It will come with the upcoming release 1.1.0
of the provider.
the config
provider "docker" {
version = "1.1.0"
host = "unix:///var/run/docker.sock"
}
resource "docker_image" "alpine" {
name = "alpine:latest"
keep_locally = true
}
resource "docker_container" "alpine" {
name = "foo"
image = "${docker_image.alpine.latest}"
command = ["ip", "a"]
networks = ["tf-net"]
}
and he following steps
# use the current master branch
# for mac
$ go build -o terraform-provider-docker_v1.1.0 && mv -f terraform-provider-docker_v1.1.0 ~/.terraform.d/plugins/darwin_amd64
$ docker network create tf-net
$ terraform apply
result in
"Networks": {
"tf-net": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"f9ee6e24549b"
],
"NetworkID": "d4d2a6aa3c7411c913bd10a0232d915f307521bdd60d4cac9653aff3f159e4cb",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
from terraform-provider-docker.
Related Issues (20)
- ci: update to go 1.15 HOT 1
- Make docker_registry_image datasource independent of docker host endpoint HOT 4
- Missing security_opt option for docker_container resource
- How can I pass private_key for ssh connection? HOT 1
- Alias fails when passed to child module.
- Image value in docker_service state doesn't stick
- Image argument after v2.6.0 always replaces resources (mismatch between image name vs sha image id) HOT 2
- Modifying labels does not recreate container
- How to use provider with simple get from https://hub.docker.com/search?q=&type=image HOT 1
- [docker_network] - check_duplicate not working
- Unable to remove Docker image: image is referenced in multiple repositories HOT 1
- Swarm Secret Data Source
- Provider can't connect to Docker daemon in WSL 2
- Crash Import service docker module with hosts include
- Call for future maintainers HOT 8
- Add support for docker plugins
- terraform destroy does not respect stop_grace_period for docker swarm services running on DOCKER_HOST
- OCI images are not supported
- Null user should not force a replacement
- Non existent or null workdir should not force replacement
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-docker.