terraform-provider-docker/templates/resources/service.md.tmpl
Manuel Vogel 4d40b84443
fix/service image name (#212)
* fix(service): remove image name suppress function
* feat: add docker image data-source
* docs(service): add example for iamge datasource usage
* fix: image repo digest with tag determination
* fix: always return a repoDigest
* fix(image): deprecation notice for latest attribute
* fix(ci): explicitly go get tfplugindocs
* fix(ci): remove gocenter.io proxy
2021-06-21 09:24:02 +02:00

64 lines
No EOL
1.7 KiB
Cheetah

---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "{{.Type}} {{.Name}} - {{.ProviderName}}"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---
<!-- Bug: Type and Name are switched -->
# {{.Type}} ({{.Name}})
{{ .Description | trimspace }}
## Example Usage
### Basic
The following configuration starts a Docker Service with
- the given image,
- 1 replica
- exposes the port `8080` in `vip` mode to the host machine
- moreover, uses the `container` runtime
{{tffile "examples/resources/docker_service/resource-basic.tf"}}
The following command is the equivalent:
{{codefile "shell" "examples/resources/docker_service/resource-basic-create.sh" }}
### Basic with Datasource
Alternatively, if the image is already present on the Docker Host and not managed
by `terraform`, you can also use the `docker_image` datasource:
{{tffile "examples/resources/docker_service/resource-basic-image-ds.tf"}}
### Advanced
The following configuration shows the full capabilities of a Docker Service,
with a `volume`, `config`, `secret` and `network`
{{tffile "examples/resources/docker_service/resource-advanced.tf"}}
{{ .SchemaMarkdown | trimspace }}
## Import
Import is supported using the following syntax by providing the `id`:
{{codefile "shell" "examples/resources/docker_service/import.sh" }}
### Example
Assuming you created a `service` as follows
{{codefile "shell" "examples/resources/docker_service/import-create.sh" }}
you provide the definition for the resource as follows
{{tffile "examples/resources/docker_service/import-resource.tf" }}
then the import command is as follows
{{codefile "shell" "examples/resources/docker_service/import-resource.sh" }}