open-consul/website/content/commands/services/index.mdx
Jeff Boruszak fe2f650240
docs: CLI page descriptions for automated checker (#16056)
* ACL

* ACL

* Catalog

* consul config

* consul connect

* top-level updates

* consul intention

* consul kv

* consul namespace

* consul peering

* consul peering delete

* consul services

* consul snapshot

* consul tls

* consul acl auth-method

* acl binding-rule

* acl policy

* acl role

* acl token

* fix

* standardization

* Update website/content/commands/snapshot/save.mdx

Co-authored-by: Bryce Kalow <bkalow@hashicorp.com>

* consul debug
consul keyring

Co-authored-by: Bryce Kalow <bkalow@hashicorp.com>
Co-authored-by: Tu Nguyen <im2nguyen@users.noreply.github.com>
2023-01-26 12:42:13 -06:00

68 lines
1.6 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Services'
description: |
The `consul services` command interacts with services registered with the local agent. It exposes top-level commands for registering and deregistering services with the Consul catalog.
---
# Consul Agent Services
Command: `consul services`
The `services` command has subcommands for interacting with Consul services
registered with the [local agent](/consul/docs/agent). These provide
useful commands such as `register` and `deregister` for easily registering
services in scripts, dev mode, etc.
To view all services in the catalog, instead of only agent-local services,
see the [`catalog services`](/consul/commands/catalog/services) command.
## Usage
Usage: `consul services <subcommand>`
For the exact documentation for your Consul version, run `consul services -h` to
view the complete list of subcommands.
```text
Usage: consul services <subcommand> [options] [args]
...
Subcommands:
deregister Deregister services with the local agent
register Register services with the local agent
```
For more information, examples, and usage about a subcommand, click on the name
of the subcommand in the sidebar.
## Basic Examples
To create a simple service:
```shell-session
$ consul services register -name=web
```
To create a service from a configuration file:
```shell-session
$ cat web.json
{
"Service": {
"Name": "web"
}
}
$ consul services register web.json
```
To deregister a service:
```
# Either style works:
$ consul services deregister web.json
$ consul services deregister -id web
```