--- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "{{.Type}} {{.Name}} - {{.ProviderName}}" subcategory: "" description: |- {{ .Description | plainmarkdown | trimspace | prefixlines " " }} --- # {{.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" }}