docker安裝ubuntu

來源:互聯網
上載者:User
ucsmy@QKTEST21190:~$ docker pull daocloud.io/ubuntu Using default tag: latestlatest: Pulling from ubuntu22ecafbbcc4a: Pulling fs layer 580435e0a086: Pulling fs layer 8321ffd10031: Downloading [==================================================>]    519 B/519 B08b8f28a13c2: Waiting 2b401702069a: Waiting write /home/ucsmy/workspace/docker/tmp/GetImageBlob518547788: no space left on device

下載ubuntu鏡像,出現磁碟空間不足的情況,用df -h查看所有的空間目錄的磁碟所用情況

ucsmy@QKTEST21190:~$ df -hFilesystem                 Size  Used Avail Use% Mounted onudev                       7.9G  4.0K  7.9G   1% /devtmpfs                      1.6G  920K  1.6G   1% /run/dev/sda4                   57G   19G   36G  34% /none                       4.0K     0  4.0K   0% /sys/fs/cgroupnone                       5.0M     0  5.0M   0% /run/locknone                       7.9G  1.4M  7.9G   1% /run/shmnone                       100M     0  100M   0% /run/user/dev/sda1                  453M   40M  386M  10% /boot/dev/sda5                   14G  148M   13G   2% /var/log/dev/sda6                  4.5G   78M  4.2G   2% /tmp/dev/mapper/vgdata-lvdata  197G  197G     0 100% /home/ucsmy/workspace

下載鏡像成功後,查看

ucsmy@QKTEST21191:~$ docker imagesREPOSITORY                                                                                                                                 TAG                 IMAGE ID            CREATED             SIZEdev-vp2-c702278d06717bb8f41b4866ec8c617fc9b0d222738ff40b680420844dc10a66e845cc321fb4ac46e9f695a31f92acb4f9448be21ca1071bf549bd05740f416c   latest              1dd23285f460        5 weeks ago         1.38 GBdev-vp3-c702278d06717bb8f41b4866ec8c617fc9b0d222738ff40b680420844dc10a66e845cc321fb4ac46e9f695a31f92acb4f9448be21ca1071bf549bd05740f416c   latest              ff70565dc2d2        5 weeks ago         1.38 GBcello-watchdog                                                                                                                             latest              06510d23fba6        9 weeks ago         709.4 MBcello-dashboard                                                                                                                            latest              e90cb34ea002        9 weeks ago         709.4 MBcello-restserver                                                                                                                           latest              e806541aa5a1        9 weeks ago         709.4 MBdaocloud.io/ubuntu                                                                                                                         latest              ebcd9d4fca80        10 weeks ago        117.9 MB

可以看到,接著用 這個ubuntu鏡像建立 容器 ,然後建立成功後自動進入容器

ucsmy@QKTEST21191:~$ docker run -it --name ubuntublock -p 80:80 ebcd9d4fca80root@f2b5cdfdc5ed:/#

-it就是以互動模式運行容器,和為容器重新分配一個偽輸入終端,簡單點就是建立並且進入容器吧,能輸入命令列那種
–name 就是為容器添加一個新名字吧
-p 連接埠對應
ebcd9d4fca80是daocloud.io/Ubuntu鏡像的image id
按快速鍵 ctrl + p + q ,可以退出容器,然後重新串連

ucsmy@QKTEST21191:~$ docker attach ubuntublockroot@f2b5cdfdc5ed:/# 

在這裡面就像一台真正的ubunt一樣
你可以運行 安裝管理器 安裝你所有想要的命令,
如安裝git

 apt-get install git

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.