terraform-provider-docker/README.md

51 lines
1.3 KiB
Markdown
Raw Normal View History

2020-12-24 10:27:42 -05:00
# Terraform Provider
2017-06-05 16:59:08 -04:00
- Website: https://www.terraform.io
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)
2017-08-31 11:05:07 -04:00
<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="600px">
2017-06-05 16:59:08 -04:00
2020-12-24 10:27:42 -05:00
## Requirements
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x
- [Go](https://golang.org/doc/install) 1.15.x (to build the provider plugin)
2017-06-05 16:59:08 -04:00
2020-12-24 10:27:42 -05:00
## Building The Provider
2017-06-05 16:59:08 -04:00
```sh
$ git clone git@github.com:terraform-providers/terraform-provider-docker
$ make build
2017-06-05 16:59:08 -04:00
```
2020-12-24 10:27:42 -05:00
## Example usage
```hcl
2020-12-24 10:27:42 -05:00
# Set the required provider and versions
terraform {
required_providers {
# We recommend pinning to the specific version of the Azure Provider you're using
# since new versions are released frequently
docker = {
source = "kreuzwerker/docker"
version = "2.8.0"
}
}
}
2020-12-24 10:27:42 -05:00
# Configure the docker provider
provider "docker" {
}
2020-12-24 10:27:42 -05:00
# Create a docker image resource
# -> docker pull nginx:latest
resource "docker_image" "foo" {
name = "c"
keep_locally = true
}
2020-12-24 10:27:42 -05:00
# Create a docker container resource
# -> docker run --name foo -d nginx:latest
resource "docker_container" "foo" {
name = "foo"
image = docker_image.foo.latest
}
```