Define roles with authorized API operationsEstimated reading time: 4 minutes
This topic applies to Docker Enterprise.
The Docker Enterprise platform business, including products, customers, and employees, has been acquired by Mirantis, inc., effective 13-November-2019. For more information on the acquisition and how it may affect you and your business, refer to the Docker Enterprise Customer FAQ.
A role defines a set of API operations permitted against a resource set. You apply roles to users and teams by creating grants.
Some important rules regarding roles:
- Roles are always enabled.
- Roles can’t be edited. To edit a role, you must delete and recreate it.
- Roles used within a grant can be deleted only after first deleting the grant.
- Only administrators can create and delete roles.
You can define custom roles or use the following built-in roles:
||Users have no access to Swarm or Kubernetes resources. Maps to
||Users can view resources but can’t create them.|
||Users can view and edit resources but can’t run a service or container in a way that affects the node where it’s running. Users cannot mount a node directory,
||Users can view nodes (worker and manager) and schedule (not view) workloads on these nodes. By default, all users are granted the
||Users can view and edit all granted resources. They can create containers without any restriction, but can’t see the containers of other users.|
Create a custom role for Swarm
When creating custom roles to use with Swarm, the Roles page lists all default and custom roles applicable in the organization.
You can give a role a global name, such as “Remove Images”, which might enable the Remove and Force Remove operations for images. You can apply a role with the same name to different resource sets.
- Click Roles under User Management.
- Click Create Role.
- Enter the role name on the Details page.
- Click Operations. All available API operations are displayed. See Swarm operations roles for a description of the available API operations.
- Select the permitted operations per resource type.
- Click Create.
Swarm operations roles
This section describes the set of operations (calls) that can be executed to the Swarm resources. Be aware that each permission corresponds to a CLI command and enables the user to execute that command.
||Manage Docker configurations. See child commands for specific examples.|
||Manage containers. See child commands for more information.|
||Create a new container. See extended description and examples for more information.|
||Create new containers. See extended description and examples for more information.|
||Update configuration of one or more containers. Using this command can also prevent containers from consuming too many resources from their Docker host. See extended description and examples for more information.|
||Remove one or more containers. See options and examples for more information.|
||Manage images. See child commands for examples.|
||Remove one or more images. See child commands for examples.|
||Manage networks. You can use child commands to create, inspect, list, remove, prune, connect, and disconnect networks.|
||Manage Swarm nodes. See child commands for examples.|
||Manage Docker secrets. See child commands for sample usage and options.|
||Manage services. See child commands for sample usage and options.|
||Create a new volume that containers can consume and store data in. See examples for more information.|
||Remove one or more volumes. Users cannot remove a volume that is in use by a container. See related commands for more information.|
Where to go next
- Create and configure users and teams
- Group and isolate cluster resources
- Grant role-access to cluster resources
- Use the Docker command line