Use docker without root - xcLtw/about_docker GitHub Wiki

This document used to ubuntu

  • Add group docker if it doesn't exist
    sudo groupadd docker
  • Add $User to the docker group,notice $User should match the user's your wanted.
    Check current user:
    whoami
    Add user:
    sudo gpasswd -a $User docker
  • Active the change to groups
    newgrp docker
  • Check for that
    docker images or docker run hello-world

20180821.add
The method before don't work for another terminal window,or after you log out. WILL Lose the group docker
SO, sudo usermod -aG docker $USER ,use it ,log out/in ,it seem work fine until now..