ubuntu 18.04安装docker-ce


Ubuntu18.04 安装 Docker CE

  1. 添加使用 https 传输的软件包和 CA证书
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
  1. 添加软件源的 GPG 密钥
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  1. 添加 docker 软件源
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  1. 安装 Docker CE
sudo apt install update
sudo apt install docker-ce
  1. 或者使用脚本自动安装
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
  1. 启动 docker
sudo systemctl enable docker
sudo systemctl start docker
  1. 建立 docker 用户组
sudo groupadd docker
  1. 将当前用户加入 docker 组
sudo usermod -aG docker $USER

退出终端并重新登录或者重启 docker。

sudo systemctl restart docker
  1. 测试使用不使用 sudo 能否执行 docker 命令
docker images

如果提示

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.40/images/json: dial unix /var/run/docker.sock: connect: permission denied

则修改/var/run/docker.sock权限

sudo chmod a+rw /var/run/docker.sock

转载于https://www.cnblogs.com/zuanzuan/p/11255631.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM