Docker ubuntu

Table of Contents

Next: , Up: (dir)   [Contents]

Docker ubuntu

This manual is for program, version version.


Previous: , Up: Top   [Contents]

1 Android build envrionment

=> Docker install and run ubuntu 12.04 client
  sudo apt-get install docker.io
  sudo docker pull ubuntu:12.04
  cat /etc/issue # check ubuntu version
  sudo docker run -v /absolute/path/to/host:/absolute/path/to/guest -i -t ubuntu:12.04 /bin/bash
    -> Note: -v 后面的两个参数指定host挂载到client的两个目录,需要替换成你自己的实际目录。
=> commit your changes

  root@cd0fc1349818:/home# exit
  exit
  $ sudo docker commit -m "android build env" cd0fc1349818 ubuntu:12.04_android_env
   [sudo] password for zzy_i7:
   sha256:25afba688c5ef5ad391ee9d0c07a6b3407d8a5f58a1bdc3c5c778ecbda141f7e
  $ sudo docker images
   REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
   ubuntu              12.04_android_env   25afba688c5e        2 minutes ago       918.9 MB
   ubuntu              12.04_test          ccceeb237a25        59 minutes ago      103.6 MB
   <none>              <none>              2ae01793d0bd        About an hour ago   103.6 MB
   ubuntu              12.04               b384dd9703db        5 weeks ago         103.6 MB
  $ sudo docker run -v /media/zzy_i7/codebase:/home/codebase -i -t ubuntu:12.04_android_env /bin/bash

  Reference: https://docs.docker.com/engine/reference/commandline/commit/
$ sudo docker images  # list images
[sudo] password for zzy_i7:
REPOSITORY          TAG                   IMAGE ID            CREATED             SIZE
ubuntu              12.04_android_env_1   7c27e497bd74        10 hours ago        918.9 MB
ubuntu              12.04                 b384dd9703db        6 weeks ago         103.6 MB

$ sudo docker save -o <save image to path> <image name>  # save image as tar file

$ sudo docker load -i <path to image tar file>           # load image from tar file

Document:  https://docs.docker.com/