日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
如何在Ubuntu14.04上安裝Docker并運(yùn)行image

如何在ubuntu 14.04上安裝Docker并運(yùn)行image

一. 環(huán)境確認(rèn)和準(zhǔn)備

1.  所要安裝的正是Trusty 14.40 (LTS), 硬件是x86_64的。

目前僅支持以下3個(gè)64 bit的Ubuntu 版本,支持x86_64 和armhf (ARM)硬件架構(gòu)。 

  • Yakkety 16.10
  • Xenial 16.04 (LTS)
  • Trusty 14.04 (LTS)

2. . 刪掉先前安裝過(guò)的舊版docker(新版的名字有變化)   sudo apt-get remove docker docker-engine          /// 新的版本中,社區(qū)版的叫docker-ce, 企業(yè)版的叫docker-ee   二.  開(kāi)始安裝 1.  安裝linux-image-extra-* 以便docker能使用aufs存儲(chǔ)驅(qū)動(dòng)   sudo apt-get update         sudo apt-get install linux-image-extra-(uname -r)  linux-image-extra-virtual  2.  安裝docker    有兩種安裝方式,一種是通過(guò)docker repository(docker 倉(cāng)庫(kù)在線安裝),另一種是下載安裝包離線安裝。   兩種方式都試了,但在線方式一直卡住不動(dòng),只好用了離線方式。兩種安裝方式分別如下: 2.1 在線安裝 a. 安裝apt通過(guò)https訪問(wèn)所需要的包 

sudo apt-get install apt-transport-https  ca-certificates  curl software-properties-common

b. 安裝docker的官方GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg  | duso apt-key add -

    并用下面命令確認(rèn)新安裝KEY的指紋是9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

  sudo apt-key fingerprint 0EBFCD88 

結(jié)果如下: 

pub   4096R/0EBFCD88 2017-02-22

      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88

uid                  Docker Release (CE deb)

sub   4096R/F273FCD8 2017-02-22

c. 安裝docker repository 到apt source 

       sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs)   stable"    //  如果是ARM架構(gòu),arch=armhf,  $(lsb_release -cs) 主要是列出當(dāng)前ubuntu disctibution名字

  sudo apt-get update 

    備注: 如果sudo add-apt-repository 或update 沒(méi)執(zhí)行成功,手工把這行加到/etc/apt/source.list中也可  

  deb [arch=amd64] https://download.docker.com/linux/ubuntu trusty stable

d. 開(kāi)始安裝

 sudo apt-get install docker-ce 

2.2 離線下載

  到https://download.docker.com/linux/ubuntu/dists/trusty/pool/stable/amd64/ 下載下面的 .deb安裝包,ubuntu 14.40對(duì)應(yīng)的是trusty,不同版本要到對(duì)應(yīng)目錄中下,速度不快

  sudo dpkg -i  path_to_package.deb     

三. 運(yùn)行確認(rèn)安裝已OK

sudo docker run hello-world 

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

b04784fba78d: Pull complete 

Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f

Status: Downloaded newer image for hello-world:latest 

Hello from Docker!

This message shows that your installation appears to be working correctly. 

To generate this message, Docker took the following steps:

 1. The Docker client contacted the Docker daemon.

 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.

 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.

 4. The Docker daemon streamed that output to the Docker client, which sent it  to your terminal. 

To try something more ambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash 

Share images, automate workflows, and more with a free Docker ID:

 https://cloud.docker.com/

For more examples and ideas, visit: https://docs.docker.com/engine/userguide/  

ps -ef | grep docker 也能看到已運(yùn)行的dockerd和docker-containerd.

  +  2003  4225  0 15:16 pts/31   00:00:00 grep --color=auto docker

root     31976     1  0 14:17 ?        00:00:04 /usr/bin/dockerd --raw-logs

root     31989 31976  0 14:17 ?        00:00:02 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc

下來(lái)就可以pull 遠(yuǎn)程的image 跑真正的項(xiàng)目了   $ sudo docker docker_dev.sh ......

四.  常用操作命令

  docker images   // list imges 

        docker ps -a       // list the containers running 

        docker pull         // download image from repository 

        docker commit      // create image

       docker rm               // delete container

       docker rmi                // delete images

       docker run                // run image/command in a new container

       docker logs xxx  (xxx 為docker images 列出的image id)  // view the logs of running image 

i.e.  running ubuntu:14.04 image

sudo docker run -i -t ubuntu /bin/bash or 

sudo docker pull ubuntu:14.04

sudo docker images

docker run -i -t ubuntu:14.04 // terminal 提示符將顯示所進(jìn)入docker的HOSTNAME

do any change in this image but exit without save, enter again, nothing changed.

docker commit xxx ubuntu:14.04 // xxx 為image id, ubuntu:14.4 為image name, 也可改為其它名字便于區(qū)分,rocker images時(shí)會(huì)顯示新的名字  

五. 備注:

1. 不想每次運(yùn)行時(shí)都帶著sudo,那就創(chuàng)建個(gè)docker給并把當(dāng)前用戶加進(jìn)去

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

 退出shell 再登錄就可以不用sudo了  docker run hello-world 


本文標(biāo)題:如何在Ubuntu14.04上安裝Docker并運(yùn)行image
分享URL:http://www.5511xx.com/article/dpspsgo.html