terraform-provider-docker
terraform-provider-docker copied to clipboard
Support for Docker exec
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Provisioning sometimes requires to run extra commands in a container using docker exec... For now we have to use null_ressource local/remote-exec to run "docker exec" commands which is not very handy as we always need to add all the "docker exec" stuff, pass the container name and so on... Would by great to add something like :
resource "docker_exec" "custom_commands" {
container = docker_container.my_container.id
trigger= ..
count= ...
command = "<any custom commands here>"
}
New or Affected Resource(s)
- docker_exec
Potential Terraform Configuration
resource "docker_container" "ftp" {
image = some-ftp-image
name = my-ftp
...
}
resource "docker_exec" "custom_commands" {
container = docker_container.my_container.id
command = <<EOT
useradd ${var.ftp_user} ...
echo "Hello ${var.ftp_user}" > "/home/${var.ftp_user}/README.txt"
EOT
}