root@duke:~# wget -qO- https://get.docker.com/ | sh
或
root@duke:~# curl -sSL https://get.docker.com/ | sh # Executing docker install script, commit: 11aa13e + sh -c apt-get update -qq>/dev/null + sh -c apt-get install -y -qq apt-transport-https ca-certificates curl software-properties-common>/dev/null + sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq ->/dev/null + sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu trusty edge"> /etc/apt/sources.list.d/docker.list + [ Ubuntu = debian ] + sh -c apt-get update -qq>/dev/null + sh -c apt-get install -y -qq --no-install-recommends docker-ce>/dev/null + sh -c docker version Client: Version: 17.11.0-ce API version: 1.34 Go version: go1.8.3 Git commit: 1caf76c Built: Mon Nov 20 18:36:37 2017 OS/Arch: Linux/amd64 Server: Version: 17.11.0-ce API version: 1.34 (minimum version 1.12) Go version: go1.8.3 Git commit: 1caf76c Built: Mon Nov 20 18:35:10 2017 OS/Arch: Linux/amd64 Experimental: false If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like: sudo usermod -aG docker your-user Remember that you will have to log out and back in for this to take effect!当要以非 root 用户可以直接运行 docker 时, 需要执行 sudo usermod -aG docker runoob 命令, 然后重新登陆, 否则会有如下报错
- WARNING: Adding a user to the "docker" group will grant the ability to run
- containers which can be used to obtain root privileges on the
- docker host.
- Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
- for more information.
来源: https://www.cnblogs.com/hzw97/p/11736524.html