Ubuntu18.04
安装
sudo apt-get install docker
给非root用户添加Docker执行权限
如果用户没有docker执行权限,终端会输出
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1: dial unix /var/run/docker.sock: connect: permission denied
设置权限
# 给$USER添加权限
# sudo usermod -aG docker $USER
或者
sudo gpasswd -a $USER docker
#更新docker组
newgrp docker
验证docker是否成功安装
docker container run hello-world
如果成功,会显示