基於 Docker 快速構建 Linux 0.11 實驗環境

來源:互聯網
上載者:User

標籤:linux   docker   linux-0-11   實驗環境   

by Falcon of TinyLab.org
2015/05/02

簡介

五分鐘內搭建 Linux 0.11 的實驗環境介紹了如何快速構建一個 Linux 0.11 實驗環境。

本文介紹如何快速構建一個獨立於宿主機的 Linux 0.11 實驗環境,該實驗環境可以用於任何作業系統的宿主開發機,將非常方便各類學生學習 Linux 0.11,本文只介紹 Ubuntu。在 Windows 和 Mac 下可以用 VirtualBox + Boot2Docker 來啟動。

下文要求已經安裝 git 和 docker,如果沒有安裝請首先安裝:

  • 安裝 git

    $ sudo apt-get install git
  • 安裝 docker

    $ sudo apt-get install software-properties-common # 增加 add-apt-repository 命令$ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:dotcloud/lxc-docker # 增加一個ppa源,如:ppa:user/ppa-name$ sudo apt-get -y update$ sudo apt-get install lxc-docker
拉下 Linux 0.11 實驗環境
$ git clone https://gitlab.com/tinylab/linux-0.11.git
通過 Docker 構建一個獨立的實驗環境
$ cd linux-0.11$ docker build -t tinylab/linux-0.11-lab ./
啟動裝有實驗環境的 Docker 容器
$ CONTAINER_ID=$(docker run -d -p 6080:6080 dorowu/ubuntu-desktop-lxde-vnc)
獲得實驗環境的密碼
$ docker logs $CONTAINER_ID | sed -n 1p    User: ubuntu Pass: ubuntu

注:登入密碼為 Pass 之後的字串,這裡為 ubuntu。

遠程登入實驗環境
  • 在本地宿主機登入
    • http://localhost:6080/vnc.html
  • 遠程登入

    • 獲得實驗環境所屬容器的 IP 位址

      $ docker exec 8222763de ifconfig eth0 | grep "inet addr:"inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
    • 訪問地址:http://172.17.0.1:6080/vnc.html

簡單使用

登入後,無須再額外安裝任何工具,因為剛才在構建 Docker 容器時就已經預設安裝好。所以用法與 五分鐘內搭建 Linux 0.11 的實驗環境 稍有差異。基本步驟如下:

  • 登入後,通過左下角的啟動菜單,找到 Accessories,再開啟控制台 LXTerminal
  • 進入實驗環境所屬目錄:cd /linux-0.11-lab
  • 進行各種開發與調試動作
    • 例如:make start-hd
    • 也可切換 bochs 啟動,例如:echo bochs > tools/vm.cfg; make start-fd
  • 更多用法請參考:make help

效果如下:

基於 Docker 快速構建 Linux 0.11 實驗環境

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.