Fetching: json-2.3.0.gem (100%) Building native extensions. This could take a while... Successfully installed json-2.3.0 1 gem installed Installing ri documentation for json-2.3.0... Installing RDoc documentation for json-2.3.0...
7c61f457e695:Container ID,透過 docker ps / docker ps -a 取得
chestertang/sinatra:v2:v2 冒號前半段是 Repository 名稱(不能大寫),後半段是 TAG
再來看看 docker images 吧!
1 2 3 4 5 6
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE chestertang/sinatra v2 3bae0e76683f 11 seconds ago 447MB ubuntu 12.04 5b117edd0b76 2 years ago 104MB training/sinatra latest 49d952a36c58 5 years ago 447MB
# This is a comment FROM ubuntu:14.04 MAINTAINER Docker Chester <[email protected]> RUN apt-get -qq update RUN apt-get -qqy install ruby ruby-dev RUN gem install sinatra
Dockerfile 的基本語法的思如下:
# 來表示註解
FROM 指令告訴 Docker 使用哪個 Image 作為基底
MAINTAINER 表示誰是這個 file 的維護者
RUN 開頭的指令會在建立中執行,比如在這裏使用 apt-get 來安裝 ruby、sinatra 套件
CONTAINER ID IMAGE COMMAND CREATED STATUS NAMES 83be203c6040 chestertang/sinatra:v2 "/bin/bash" 48 minutes ago Exited (0) 18 minutes ago elastic_hertz 2f902d9238f5 chestertang/sinatra:v2 "/bin/bash" 4 days ago Exited (130) 4 days ago confident_ritchie d7b639b8385a ubuntu:12.04 "/bin/bash" 7 days ago Exited (127) 7 days ago dreamy_hypatia 1d8d58333b3d ubuntu:12.04 "/bin/bash" 7 days ago Exited (130) 7 days ago wizardly_morse c9a19d3553c9 ubuntu:12.04 "/bin/bash" 7 days ago Exited (0) 7 days ago interesting_dubinsky bcf468d00ca2 hello-world "/hello" 9 days ago Exited (0) 9 days ago inspiring_newton
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE chestertang/sinatra v2 3bae0e76683f 7 days ago 447MB ubuntu 14.04 6e4f1fe62ff1 5 weeks ago 197MB hello-world latest fce289e99eb9 13 months ago 1.84kB ubuntu 12.04 5b117edd0b76 2 years ago 104MB joshhu/webdemo latest c58bf6158823 4 years ago 243MB training/sinatra latest 49d952a36c58 5 years ago 447MB