参考docker官方教程

简略概括一下:

  1. sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  2. curl -sSL https://get.docker.com/ | sh

Log into Ubuntu as a user with sudo privileges. This procedure assumes you log in as the ubuntu user.

Create the docker group.

$ sudo groupadd docker

Add your user to docker group.

$ sudo usermod -aG docker ubuntu

Log out and log back in. This ensures your user is running with the correct permissions.