> To run Docker without root privileges, see
> [Run the Docker daemon as a non-root user (Rootless mode)](../security/rootless.md).
To create the `docker` group and add your user:
1. Create the `docker` group.
```console
$ sudo groupadd docker
```
2. Add your user to the `docker` group.
```console
$ sudo usermod -aG docker $USER
```
3. Log out and log back in so that your group membership is re-evaluated.
> If you're running Linux in a virtual machine, it may be necessary to
> restart the virtual machine for changes to take effect.
You can also run the following command to activate the changes to groups:
```console
$ newgrp docker
```
4. Verify that you can run `docker` commands without `sudo`.
```console
$ docker run hello-world
```
This command downloads a test image and runs it in a container. When the
container runs, it prints a message and exits.
If you initially ran Docker CLI commands using `sudo` before adding your user
to the `docker` group, you may see the following error:
```none
WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied
```
This error indicates that the permission settings for the `~/.docker/`
directory are incorrect, due to having used the `sudo` command earlier.
To fix this problem, either remove the `~/.docker/` directory (it's recreated
automatically, but any custom settings are lost), or change its ownership and
permissions using the following commands:
```console
$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
$ sudo chmod g+rwx "$HOME/.docker" -R
```
## Configure Docker to start on boot with systemd
Many modern Linux distributions use [systemd](https://systemd.io/) to
manage which services start when the system boots. On Debian and Ubuntu, the
Docker service starts on boot by default. To automatically start Docker and
containerd on boot for other Linux distributions using systemd, run the
following commands:
```console
$ sudo systemctl enable docker.service
$ sudo systemctl enable containerd.service
```
To stop this behavior, use `disable` instead.
```console
$ sudo systemctl disable docker.service
$ sudo systemctl disable containerd.service
```
You can use systemd unit files to configure the Docker service on startup,
for example to add an HTTP proxy, set a different directory or partition for the
Docker runtime files, or other customizations. For an example, see
[Configure the daemon to use a proxy](/manuals/engine/daemon/proxy.md#systemd-unit-file).
## Configure default logging driver
Docker provides [logging drivers](/manuals/engine/logging/_index.md) for
collecting and viewing log data from all containers running on a host. The
default logging driver, `json-file`, writes log data to JSON-formatted files on
the host filesystem. Over time, these log files expand in size, leading to
potential exhaustion of disk resources.
To avoid issues with overusing disk for log data, consider one of the following
options:
- Configure the `json-file` logging driver to turn on
[log rotation](/manuals/engine/logging/drivers/json-file.md).
- Use an
[alternative logging driver](/manuals/engine/logging/configure.md#configure-the-default-logging-driver)
such as the ["local" logging driver](/manuals/engine/logging/drivers/local.md)
that performs log rotation by default.
- Use a logging driver that sends logs to a remote logging aggregator.
## Next steps
- Take a look at the [Docker workshop](/get-started/workshop/_index.md) to learn how to build an image and run it as a containerized application.