Ubuntu 16.04にDocker Ceをインストール

7078 ワード

Ubuntu 16.04にDocker Ceをインストール
  • 旧バージョン
    
    #       docker.io,    
    
    eric@userver:~$ sudo apt-get remove docker docker-engine docker.io
  • をアンインストール
  • AFSカーネル駆動モジュール
    
    #aufs docker           ,        ,      
    
    eric@userver:~$ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
  • を取り付ける.
  • インストールミラーソース
    
    #    https      CA  ,         
    
    eric@userver:~$ sudo apt update
    eric@userver:~$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
    
    
    #   ,  
    
    eric@userver:~$ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    
    
    #   ,    ,       
    
    eric@userver:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  • 追加ソフトウェアソース
    
    # soruce.list   Docker   
    
    eric@userver:~$ sudo add-apt-repository  "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
    
  • Docker CE
    
    #        (  )
    
    eric@userver:~$ curl -fsSL get.docker.com -o get-docker.sh
    eric@userver:~$ sudo sh get-docker.sh --mirror Aliyun
    
    
    #apt   docker ce
    
    eric@userver:~$ sudo apt-get update
    eric@userver:~$ sudo apt-get install docker-ce
  • を取り付ける
  • Docker CE
    eric@userver:~$ sudo systemctl enable docker
    eric@userver:~$ sudo systemctl start docker
    
    
    #ubuntu14.04      
    
    eric@userver:~$ sudo service docker start
  • を起動する
  • 現在のユーザをdockerグループ
    
    #    ,docker     unix socket  docker    ,  root docker       
    
    
    #  docker :    docker      
    
    eric@userver:~$ sudo groupadd docker
    
    #        docker  
    
    sudo usermod -aG docker $USER
    
    
    #    ,       
    
  • に加入する.
  • テスト
    eric@userver:~$ docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    ca4f61b1923c: Pull complete 
    Digest: sha256:445b2fe9afea8b4aa0b2f27fe49dd6ad130dfe7a8fd0832be5de99625dad47cd
    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.
      (amd64)
    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/
    
    
    #         hello-world
    
    eric@userver:~$ docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    hello-world         latest              f2a91732366c        4 weeks ago         1.85kB
    
  • ミラーリング加速国内ネットワークの問題でdokcerミラーリングを引き出すのは非常に遅いため、国内ミラーリング加速の配置を提案する.私が使っているのはアリ雲加速(https://yq.aliyun.com/articles/29941)