github.com/outbrain/consul@v1.4.5/website/source/docs/commands/services.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Commands: Services" 4 sidebar_current: "docs-commands-services" 5 --- 6 7 # Consul Agent Services 8 9 Command: `consul services` 10 11 The `services` command has subcommands for interacting with Consul services 12 registered with the [local agent](/docs/agent/basics.html). These provide 13 useful commands such as `register` and `deregister` for easily registering 14 services in scripts, dev mode, etc. 15 To view all services in the catalog, instead of only agent-local services, 16 see the [`catalog services`](/docs/commands/catalog/services.html) command. 17 18 ## Usage 19 20 Usage: `consul services <subcommand>` 21 22 For the exact documentation for your Consul version, run `consul services -h` to 23 view the complete list of subcommands. 24 25 ```text 26 Usage: consul services <subcommand> [options] [args] 27 28 ... 29 30 Subcommands: 31 deregister Deregister services with the local agent 32 register Register services with the local agent 33 ``` 34 35 For more information, examples, and usage about a subcommand, click on the name 36 of the subcommand in the sidebar. 37 38 ## Basic Examples 39 40 To create a simple service: 41 42 ```text 43 $ consul services register -name=web 44 ``` 45 46 To create a service from a configuration file: 47 48 ```text 49 $ cat web.json 50 { 51 "Service": { 52 "Name": "web" 53 } 54 } 55 56 $ consul services register web.json 57 ``` 58 59 To deregister a service: 60 61 ```sh 62 # Either style works: 63 $ consul services deregister web.json 64 65 $ consul services deregister -id web 66 ```