open-consul/website/pages/commands/services/index.mdx
Jasmine W 8ae3332165
docs: update structure (#8506)
- moved and renamed files/folders based on new structure
- updated docs navigation based on new structure
- moved CLI to top nav (created commands.jsx and commands-navigation.js)
- updated and added redirects
- updating to be consistent with standalone categories
- changing "overview" link in top nav to lead to where intro was moved (docs/intro)
- adding redirects for intro content
- deleting old intro folders
- format all data/navigation files
- deleting old commands folder
- reverting changes to glossary page
- adjust intro navigation for removal of 'vs' paths
- add helm page redirect
- fix more redirects
- add a missing redirect
- fix broken anchor links and formatting mistakes
- deleted duplicate section, added redirect, changed link
- removed duplicate glossary page
2020-09-01 11:14:13 -04:00

67 lines
1.4 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Services'
sidebar_title: services
---
# Consul Agent Services
Command: `consul services`
The `services` command has subcommands for interacting with Consul services
registered with the [local agent](/docs/agent/basics). 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`](/docs/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
```