Docker – Linux Container Management Tool

Docker 是一個 Linux Container 的管理工具

docker pull ubuntu // get images, first time to create an image use

>sudo docker pull ubuntu
Pulling repository ubuntu
58faa899733f: Download complete 
ea7d6801c538: Download complete 
3db9c44f4520: Download complete 
463ff6be4238: Download complete 
195eb90b5349: Download complete 
c5881f11ded9: Download complete 
e54ca5efa2e9: Download complete 
511136ea3c5a: Download complete 
e7d62a8128cf: Download complete 
2c2b6e9ee5ba: Download complete 
6c3df001ea12: Download complete 
3af9d794ad07: Download complete 
d7ac5e4f1812: Download complete 
65b7e9ccb809: Download complete 
f127542f0b61: Download complete 
bac448df371d: Download complete 
6cfa4d1f33fb: Download complete 
fae16849ebe2: Download complete 
f8dd6bd14f58: Download complete 
a343823119db: Download complete 
0f4aac48388f: Download complete 
209ea56fda6d: Download complete 
dfaad36d8984: Download complete 
5796a7edb16b: Download complete 
b7c6da90134e: Download complete 
47dd6d11a49f: Download complete 
2f4b4d6a4a06: Download complete 
83ff768040a0: Download complete 
6c37f792ddac: Download complete 

docker images // list all images

>sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              14.10               58faa899733f        2 weeks ago         196 MB
ubuntu              utopic              58faa899733f        2 weeks ago         196 MB
ubuntu              12.04               ea7d6801c538        3 weeks ago         127.5 MB
ubuntu              precise             ea7d6801c538        3 weeks ago         127.5 MB
ubuntu              12.10               c5881f11ded9        3 weeks ago         172.2 MB
ubuntu              quantal             c5881f11ded9        3 weeks ago         172.2 MB
ubuntu              13.04               463ff6be4238        3 weeks ago         169.4 MB
ubuntu              raring              463ff6be4238        3 weeks ago         169.4 MB
ubuntu              13.10               195eb90b5349        3 weeks ago         184.7 MB
ubuntu              saucy               195eb90b5349        3 weeks ago         184.7 MB
ubuntu              trusty              e54ca5efa2e9        3 weeks ago         276.5 MB
ubuntu              14.04               e54ca5efa2e9        3 weeks ago         276.5 MB
ubuntu              latest              e54ca5efa2e9        3 weeks ago         276.5 MB
<none>              <none>              a7cf8ae4e998        11 weeks ago        171.3 MB
busybox             latest              2d8e5b282c81        11 weeks ago        2.489 MB
ubuntu              10.04               3db9c44f4520        12 weeks ago        183 MB
ubuntu              lucid               3db9c44f4520        12 weeks ago        183 MB

docker run [image] -i -t ubuntu // run a command in a new container

>sudo docker run -t -i ubuntu:12.04 bash
root@96c5f0b2c4ef:/# 

Other Commands

    attach    Attach to a running container
    build     Build a container from a Dockerfile
    commit    Create a new image from a container's changes
    cp        Copy files/folders from the containers filesystem to the host path
    diff      Inspect changes on a container's filesystem
    events    Get real time events from the server
    export    Stream the contents of a container as a tar archive
    history   Show the history of an image
    images    List images
    import    Create a new filesystem image from the contents of a tarball
    info      Display system-wide information
    inspect   Return low-level information on a container
    kill      Kill a running container
    load      Load an image from a tar archive
    login     Register or Login to the docker registry server
    logs      Fetch the logs of a container
    port      Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
    ps        List containers
    pull      Pull an image or a repository from the docker registry server
    push      Push an image or a repository to the docker registry server
    restart   Restart a running container
    rm        Remove one or more containers
    rmi       Remove one or more images
    run       Run a command in a new container
    save      Save an image to a tar archive
    search    Search for an image in the docker index
    start     Start a stopped container
    stop      Stop a running container
    tag       Tag an image into a repository
    top       Lookup the running processes of a container
    version   Show the docker version information
    wait      Block until a container stops, then print its exit code

Docker 可以讓你用類似 Git 的方式 commit 目前 container 的狀態
並且可以 push 到 Docker Hub

Reference:

  1. Docker:http://www.docker.com
  2. Vagrant:http://www.vagrantup.com/
  3. Docker vs Vagrant
    http://stackoverflow.com/questions/16647069/should-i-use-vagrant-or-docker-io-for-creating-an-isolated-environment
  4. http://www.codedata.com.tw/social-coding/docker-layman-abc/

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google photo

您的留言將使用 Google 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s