1、创建用户,赋予sudo免密权限。
sudo useradd -d /home/forths -m forths
sudo passwd forths
echo "forths ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/forths
sudo chmod 0440 /etc/sudoers.d/forths
sudo usermod -s /bin/bash forths
2、docker官网地址:https://docs.docker.com/install/linux/docker-ce/ubuntu/
3、步骤
Uninstall old versions
sudo apt-get remove docker docker-engine docker.io containerd runc
Install Docker CE
#Set up the repository
sudo apt-get update
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 -
## verify
sudo apt-key fingerprint 0EBFCD88
## x86_64
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Install Docker CE
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
# Verify
sudo docker run hello-world
如下图则表示成功安装:
docker 免sudo--->>> https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user