Ubuntu 23.10 + Docker

huangapple go评论55阅读模式
英文:

Ubuntu 23.10 + Docker

问题

I've translated your text:

我已将我的Ubuntu升级到23.10,然后开始遇到了一些与Docker有关的问题。我进行了完全卸载,现在无法再次安装它。
当我运行
sudo apt install docker-ce docker-ce-cli containerd.io
时,我会得到以下错误:

读取软件包列表... 完成
构建依赖树... 完成
读取状态信息... 完成
软件包docker-ce-cli不可用,但被另一个软件包引用。
这可能意味着软件包丢失,已被淘汰,或者
只能从其他来源获得
但是以下软件包替代它:
  docker-buildx-plugin

E: 找不到软件包docker-ce
E: 软件包'docker-ce-cli'没有可安装的候选项
E: 找不到软件包containerd.io
E: 无法通过'containerd.io'找到任何软件包

我查看了官方的Docker页面(太晚了,当然...)并看到以下信息:
要安装Docker引擎,您需要以下Ubuntu版本的64位版本:

  • Ubuntu Lunar 23.04
  • Ubuntu Kinetic 22.10
  • Ubuntu Jammy 22.04(LTS)
  • Ubuntu Focal 20.04(LTS)
  • Ubuntu Bionic 18.04(LTS)

所以现在我有一个问题。有人有什么想法吗?我已经通过snap安装了docker,但运行docker-compose up --build时遇到了问题,错误消息是“尝试连接到Docker守护程序套接字时权限被拒绝:`”。

我还尝试安装Docker桌面版,但没有成功,我得到了一个错误消息,其中写着“无法安装docker-dfesktop:以下软件包存在不满足的依赖关系:”...而没有列出任何软件包。

有人遇到类似的问题,知道如何解决吗?

英文:

I've updated my Ubuntu to 23.10, and than I started to have several issues with docker. I did a full uninstall, and now I can't install it again.
When I run
sudo apt install docker-ce docker-ce-cli containerd.io
I get error like

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package docker-ce-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  docker-buildx-plugin

E: Unable to locate package docker-ce
E: Package 'docker-ce-cli' has no installation candidate
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'

I checked the official Docker page (to late, of course..) and saw this:
To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:

  • Ubuntu Lunar 23.04
  • Ubuntu Kinetic 22.10
  • Ubuntu Jammy 22.04 (LTS)
  • Ubuntu Focal 20.04 (LTS)
  • Ubuntu Bionic 18.04 (LTS)

So now I have an issue. Anyone has any idea on what to do? I've installed docker via snap, but than I get issue like permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: when running docker-compose up --build.

I also tried to install Docker desktop, no luck and I get an error stating "Unable to install docker-dfesktop: The following packages have unmet dependencies:"...And there are no packages listed.

Anyone had simmilar issue, knows how to tackle this?

答案1

得分: 1

> 所以现在我有一个问题。有人有任何想法要怎么办?我通过 snap 安装了 docker,但然后我遇到了权限被拒绝的问题,当我尝试连接到 Docker 守护程序套接字时出现 unix:///var/run/docker.sock: 运行 docker-compose up --build 时。
TL;DR
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
我在新安装时遇到过这个问题几次,我通常最终会在谷歌上搜索这个问题,并找到相同的数字海洋帖子。
https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket
据我理解,这是因为 docker 想要访问由 root 拥有的套接字。因此,如果你每次需要运行时未给 docker 添加 "sudo" 前缀,你将会收到此错误。如果你创建一个 docker 组,当 docker 启动时,它将创建一个对该组内部可访问的套接字。
对于高安全性和生产环境,可能要阅读官方的 Docker 文章:
https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user
不确定这是否对你有用,但试一试。
1: https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket
2: https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user

英文:

> So now I have an issue. Anyone has any idea on what to do? I've installed docker via snap, but than I get issue like permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: when running docker-compose up --build.

TL;DR

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

I've had this issue a couple of times with new installs, I usually just end up searching for the problem in google and come up with the same digital ocean post.

https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket

From what I understand it is because docker wants access to the sock that is owned by root. So you will get this error if you fail to prefixing docker with "sudo" each time you need run. If you create a docker group, when docker starts it will then create a sock accessible to those within that group.

For high security and production environment, probably have a read of the official docker post:

https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user

Not sure if this is going to work for you but give it a go.

huangapple
  • 本文由 发表于 2023年5月29日 17:54:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76356338.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定