docker ubuntu 开发环境搭建

  OS:win10 pro X64

  安装docker ce for Windows,采用Linux container,默认配置。

  1. docker run --network host -i -t ubuntu即可进入ubuntu-16.04.3命令行,用户为root。-i表示交互,否则无法输入内容到命令行;-t表示通过terminal进行交互;--network host可以加快apt-get update的速度?
  2. apt-get update && apt-get install apt-transport-https
  3. mv /etc/apt/sources.list /etc/apt/sources.list.bak备份原来的更新源;

        cat > /etc/apt/sources.list << "EOF"

        deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
        deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse

        deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
        deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

        deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
        deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

        deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
        deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

        EOF

      apt-get update 更新源。

  4. docker commit containerID repo:tag生成一个image,否则在当前container停止后其中所做的更改都会消失。
posted @ 2017-08-14 14:17  glob  阅读(772)  评论(0编辑  收藏  举报