Docker is util for create containers where you run programs you don't trust, software you don't want to install in your machine, servers and many other things
The first step is update your software
sudo apt update
sudo apt dist-upgrade
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
You should be looking to something like this:
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017-02-22 [S]
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get install docker-ce docker-ce-cli containerd.io
If you want to use docker and don't relay in sudo
one way to do it is add your user to the docker group
sudo usermod -aG docker $USER
sudo docker run hello-world