节点

学习docker:安装

2023-02-04  本文已影响0人  小明的数据分析笔记本

linux操作系统

查了一下,了解到好像只有root用户能够安装docker (不确定),还好自已租了一台云服务器,有root权限

那安装好以后普通用户可以使用docker吗?

安装参考链接

https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

sudo apt-get update
 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

报错提示

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 containerd.io : Depends: libseccomp2 (>= 2.5.0) but 2.4.1-0ubuntu0.18.04.2 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

按照提示运行

apt --fix-broken install

这次没有报错

按照安装教程

sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

应该是安装成功了

试了一下在普通专户下运行docker

docker run hello-world

报错

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

安装这个教程 https://www.jianshu.com/p/74ed513ba4b8

试了一下添加普通用户

sudo gpasswd -a chloro docker
sudo systemctl restart docker

普通用户断开重新链接

docker run hello-world

可以用了

上一篇下一篇

猜你喜欢

热点阅读