gpt4 book ai didi

docker - "lxd"与 lxc/docker 有何不同?

转载 作者:IT老高 更新时间:2023-10-28 12:41:49 24 4
gpt4 key购买 nike

问题

  • lxd 如何在容器中提供完整的操作系统功能,而不仅仅是单个进程?
  • 它与 lxc/docker + wrappers 有什么不同?
  • 它是否类似于使用 docker + supervisor/wrapper 脚本启动的容器以在一个容器中包含多个进程?

换句话说:

  • 我可以用 lxd 做什么,而我不能用 lxc 和 docker 上的一些包装器来做?
  • 如果它们使用主线内核功能(命名空间和 cgroup),为什么它只在 ubuntu 中可用?

最佳答案

How does lxd provide Full operating system functionality within containers, not just single processes?

容器是独立的 Linux 系统,在 Linux 内核中使用 cgroups 功能来限制 cpu/memory/network/etc,无需启动完整的虚拟机。

LXD 使用 liblxc(基于 LXC)提供的功能,由此产生了完整的操作系统功能。

How is it different from lxc/docker + wrappers?

LXD 使用来自 LXC 的 liblxc。 Docker 更侧重于应用程序,只有容器内应用程序的主要进程(现在默认使用 libcontainer,Docker 确实为此首先使用了 liblxc)

Is it similar to a container that is launched with docker + supervisor/wrapperscript to contain multiple processes in one container?

类似的东西。 LXD 和 Docker 的区别在于 Docker 是一个应用容器,LXD 是一个系统容器。 LXD 在容器内使用 upstart/systemd 之类的主要进程,默认情况下已准备好成为一个完整的 VM 环境,内存/cpu 使用率非常低。是的,您可以使用 supervisorctl/runit 构建您的 docker,但您需要手动执行此过程。您可以在 http://phusion.github.io/baseimage-docker/ 中查看如何完成在容器内做类似的事情。

What can I do with lxd that I cannot do with some wrappers over lxc and docker ?

实时迁移容器,像使用完整的虚拟机一样使用容器,精确配置专用 cpu 内核/内存/网络 I/O 以在容器中使用,以非特权模式运行容器进程(容器内的根进程!=您主机中的 root 进程)默认情况下 Docker 在特权模式下工作,只是现在在 Docker 1.10 中它们实现了非特权模式,但您需要查看(并且可能重写)您的 Dockerfile,因为很多东西在非特权模式下无法运行。

LXD 和 Docker 是不同的东西。 LXD 在容器中为您提供“完整操作系统”,您可以使用任何在 VM 中工作的部署工具在 LXD 中部署应用程序。使用 Docker,您的应用程序位于容器内,您需要不同的工具来在 Docker 中部署应用程序并衡量性能。 Docker 旨在运行在各种操作系统平台上,例如 Windows。 LXD/LXC 只能在 Linux 上运行:这就是 Docker 不再使用 LXC 作为其堆栈的一部分的原因。

Why is it available only in ubuntu if they are making use of mainline kernel features (namespaces and cgroup )?

如果需要,LXD 有来自 Canonical 的商业支持,但你可以在 Centos 7 中构建 LXD,ArchLinux(内核补丁)检查 https://github.com/lxc/lxd . Gentoo 现在支持 LXD https://wiki.gentoo.org/wiki/LXD .

关于docker - "lxd"与 lxc/docker 有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30430526/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com