youtube-cli/docker-setup.md

1.0 KiB

Docker No-Sudo Setup Guide

To run Docker commands without sudo, you need to add your user to the docker group. Here's how to do it:

Add User to Docker Group

sudo usermod -aG docker $USER

Apply Group Changes

After adding to the group, you need to either:

  1. Log out and log back in, or
  2. Run this command to apply changes without logging out:
newgrp docker

Verify Setup

Check that you can run Docker commands without sudo:

docker info

Alternative: Create Docker Socket Permissions

If you prefer not to add users to groups, you can modify socket permissions:

sudo chmod 666 /var/run/docker.sock

Security Note

Adding users to the docker group provides full Docker daemon access. This is equivalent to having root access, so only add trusted users to this group.

Persistent Setup

To make this change persistent across reboots:

  1. Ensure the docker service is enabled: sudo systemctl enable docker
  2. The group membership will persist after reboot