自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

LXD 2.0 系列(八):LXD中的LXD

系統(tǒng) Linux 系統(tǒng)運維
這是 LXD 2.0 系列介紹文章的第八篇。最簡單的情況可以使用 Ubuntu 16.04 鏡像來展示。 Ubuntu 16.04 云鏡像預(yù)裝了 LXD。守護(hù)進(jìn)程本身沒有運行,因為它是由套接字激活的,所以它不使用任何資源,直到你真正使用它。

這是 LXD 2.0 系列介紹文章的第八篇。

  1. LXD 入門
  2. 安裝與配置
  3. 你的***個 LXD 容器
  4. 資源控制
  5. 鏡像管理
  6. 遠(yuǎn)程主機(jī)及容器遷移
  7. LXD 中的 Docker

介紹

在上一篇文章中,我介紹了如何在 LXD 中運行 Docker,這是一個訪問由 Docker 提供的應(yīng)用程序組合的很好方式,同時 Docker 還運行在 LXD 提供的安全環(huán)境中。

我提到的一個情況是為你的用戶提供一個 LXD 容器,然后讓他們使用他們的容器來運行 Docker。那么,如果他們自己想要在其容器中使用 LXD 運行其他 Linux 發(fā)行版,或者甚至允許另一組人來訪問運行在他們的容器中的 Linux 系統(tǒng)呢?

原來 LXD 使得用戶運行嵌套容器變得非常簡單。

嵌套 LXD

最簡單的情況可以使用 Ubuntu 16.04 鏡像來展示。 Ubuntu 16.04 云鏡像預(yù)裝了 LXD。守護(hù)進(jìn)程本身沒有運行,因為它是由套接字激活的,所以它不使用任何資源,直到你真正使用它。

讓我們啟動一個啟用了嵌套的 Ubuntu 16.04 容器:

  1. lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true 

你也可以在一個已有的容器上設(shè)置 security.nesting:

  1. lxc config set <container name> security.nesting true 

或者對所有的容器使用一個指定的配置文件:

  1. lxc profile set <profile name> security.nesting true 

容器啟動后,你可以從容器內(nèi)部得到一個 shell,配置 LXD 并生成一個容器:

  1. stgraber@dakara:~$ lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true 
  2. Creating c1 
  3. Starting c1 
  4. stgraber@dakara:~$ lxc exec c1 bash 
  5. root@c1:~# lxd init 
  6. Name of the storage backend to use (dir or zfs): dir 
  7. We detected that you are running inside an unprivileged container. 
  8. This means that unless you manually configured your host otherwise, 
  9. you will not have enough uid and gid to allocate to your containers. 
  10. LXD can re-use your container's own allocation to avoid the problem. 
  11. Doing so makes your nested containers slightly less safe as they could 
  12. in theory attack their parent container and gain more privileges than 
  13. they otherwise would. 
  14. Would you like to have your containers share their parent's allocation (yes/no)? yes 
  15. Would you like LXD to be available over the network (yes/no)? no 
  16. Do you want to configure the LXD bridge (yes/no)? yes 
  17. Warning: Stopping lxd.service, but it can still be activated by
  18.  lxd.socket 
  19. LXD has been successfully configured. 
  20. root@c1:~# lxc launch ubuntu:14.04 trusty 
  21. Generating a client certificate. This may take a minute... 
  22. If this is your first time using LXD, you should also run: sudo lxd init 
  23. Creating trusty 
  24. Retrieving image: 100% 
  25. Starting trusty 
  26. root@c1:~# lxc list 
  27. +--------+---------+-----------------------+----------------------------------------------+------------+-----------+ 
  28. |  NAME  |  STATE  |         IPV4          |                     IPV6                     |    TYPE    | SNAPSHOTS | 
  29. +--------+---------+-----------------------+----------------------------------------------+------------+-----------+ 
  30. | trusty | RUNNING | 10.153.141.124 (eth0) | fd7:f15d:d1d6:da14:216:3eff:fef1:4002 (eth0) | PERSISTENT | 0         | 
  31. +--------+---------+-----------------------+----------------------------------------------+------------+-----------+ 
  32. root@c1:~# 

就是這樣簡單。

在線演示服務(wù)器

因為這篇文章很短,我想我會花一點時間談?wù)撐覀冞\行中的演示服務(wù)器。我們今天早些時候剛剛達(dá)到了 10000 個會話!

這個服務(wù)器基本上只是一個運行在一個相當(dāng)強(qiáng)大的虛擬機(jī)上的正常的 LXD,一個小型的守護(hù)進(jìn)程實現(xiàn)了我們的網(wǎng)站所使用的 REST API。

當(dāng)你接受服務(wù)條款時,將為你創(chuàng)建一個新的 LXD 容器,并啟用 security.nesting,如上所述。接著你就像使用 lxc exec 時一樣連接到了那個容器,除了我們使用 websockets 和 javascript 來做這些。

你在此環(huán)境中創(chuàng)建的容器都是嵌套的 LXD 容器。如果你想,你可以進(jìn)一步地嵌套。

我們?nèi)秶厥褂昧?LXD 資源限制,以防止一個用戶的行為影響其他用戶,并仔細(xì)監(jiān)控服務(wù)器的任何濫用跡象。

如果你想運行自己的類似的服務(wù)器,你可以獲取我們的網(wǎng)站和守護(hù)進(jìn)程的代碼:

  1. git clone https://github.com/lxc/linuxcontainers.org 
  2. git clone https://github.com/lxc/lxd-demo-server 

額外信息

LXD 的主站在: https://linuxcontainers.org/lxd

LXD 的 GitHub 倉庫: https://github.com/lxc/lxd

LXD 的郵件列表: https://lists.linuxcontainers.org

LXD 的 IRC 頻道: #lxcontainers on irc.freenode.net 

責(zé)任編輯:龐桂玉 來源: Linux中國
相關(guān)推薦

2016-07-29 14:12:21

2017-02-27 19:27:52

LXDDockerLinux

2017-03-08 18:00:10

LXD 2.0LinuxOpenStack

2017-03-08 10:40:14

LXD 2.0JujuLinux

2017-03-09 16:32:03

LXD 2.0Linux調(diào)試

2017-01-12 15:37:34

LinuxLXD 2.0鏡像管理

2016-12-29 11:01:03

LinuxLXD 2.0資源控制

2017-03-07 16:41:03

LXD 2.0Linux實時遷移

2016-08-24 15:12:41

LXDLinux容器

2016-08-22 21:41:37

LXDLinux容器管理器

2017-02-05 14:52:42

2015-04-24 10:57:22

Ubuntu 15.0Ubuntu

2017-12-25 13:51:32

LinuxUbuntu LinuLXD容器

2014-11-20 10:12:59

Docker容器LXDCanonica

2023-02-03 17:47:28

2021-06-28 05:59:17

Webpack 前端打包與工程化

2017-11-01 15:38:54

jvm知識點總覽

2011-04-29 09:15:16

Servlet

2009-01-20 09:31:42

Web 2.02009預(yù)測

2009-08-05 18:34:07

堆棧遍歷
點贊
收藏

51CTO技術(shù)棧公眾號