For ease of use, we can allow a nonroot user to administer Docker by adding it to a Docker group. This is not required when using Docker on Mac or Windows.
Adding a nonroot user to administer Docker
Getting ready
To prepare to add a nonroot user to administer Docker, go through the following steps:
- Create the Docker group, if it is not there already:
$ sudo groupadd docker
- Create the user to whom you want to give permissions to administer Docker:
$ sudo useradd dockertest
How to do it...
Run the following command to add the newly created user to administer Docker:
$ sudo usermod -aG docker dockertest
How it works...
The preceding command will add a user to the Docker group. The added user will thus be able to perform all Docker operations.