星期三, 9月 02, 2015

docker with openSUSE 13.2 小記

最近覺得真的要撥一點時間學 docker 了...
OS 採用 openSUSE 13.2, 因為套件庫就內建 docker 了

OS: openSUSE 13.2


主要練習教材 《Docker —— 從入門到實踐­》正體中文版

docker 安裝

使用 zypper 指令安裝 docker
> sudo   zypper   in   docker

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

   #1) Respect the privacy of others.
   #2) Think before you type.
   #3) With great power comes great responsibility.

root's password: 輸入 root 密碼

6  新套件將被安裝.
Overall download size: 6.8 MiB. Already cached: 0 B  完成操作後,將增加 33.5 MiB 的使用。
要繼續嗎? [y/n/? shows all options] (y):  輸入y

啟動 docker
> sudo  systemctl  start   docker

設定開機啟動 docker
> sudo  systemctl   enable   docker

Docker 官網有段文字要注意 ( 一般使用者如果要使用 docker, 要被加入到 docker 群組 )
The docker package creates a new group named docker. Users, other than root user, need to be part of this group in order to interact with the Docker daemon. You can add users with:
$ sudo   /usr/sbin/usermod   -a   -G   docker   <username>

驗證是否成功
> sudo   docker   run   --rm   -i   -t   opensuse    /bin/bash
Unable to find image 'opensuse:latest' locally
latest: Pulling from opensuse
5b8dd08af89b: Pull complete
d6b241b32a2d: Already exists
opensuse:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:d1e63126409bb816d11891776c9315f6432f66102825cde6a0055e2cfddcd3a4
Status: Downloaded newer image for opensuse:latest
目前是在 docker 內的 /bin/bash, 查看系統版本 ( 但是我也是 openSUSE 13.2 啊 ~~ )
bash-4.2# cat   /etc/*release
openSUSE 13.2 (x86_64)
VERSION = 13.2
CODENAME = Harlequin
# /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead
NAME=openSUSE
VERSION="13.2 (Harlequin)"
VERSION_ID="13.2"
PRETTY_NAME="openSUSE 13.2 (Harlequin) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:13.2"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"
輸入 exit 離開
# exit

既然來了就測試一下別的 OS 吧 ^^
利用 docker pull 下載映像檔
> sudo   docker   pull   ubuntu:12.04
root's password:
12.04: Pulling from ubuntu

ba2b457ecfb2: Downloading [================>                                  ]  14.6 MB/43.92 MB

列出本機映像檔
> sudo   docker   images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              12.04               57bca5139a13        12 days ago         134.8 MB
opensuse            latest              d6b241b32a2d        5 weeks ago         93.99 MB


今天先到這邊

~ enjoy it

沒有留言: