本文先容了 Docker 在 openSUSE 情况下的具体安装进程,并实验运行一个简朴 Spring Boot 的 image 来感觉下 Docker 的风范。
什么是 Docker
Docker 是为开拓人员和系统打点员用于构建、宣布、并运行漫衍式应用措施的开放式平台。该平台由 Docker 引擎(一个便携、轻巧的运行时和打包东西) 和 Docker Hub (一个共享应用措施和自动化事情流的云处事)等构成。Docker 可以使应用措施从组件迅速组装并消除了开拓、质量担保和出产情况之间的摩擦问题。这样一来,IT部分可以更快地宣布,而这些应用措施不管是运行在条记本电脑、数据中心的虚拟机,照旧任何的云,其运行进程和功效都是一致的。
更多有关 Docker 的先容,可以参阅《简述 Docker》 一文。
前置条件
利用 uname -r 查抄 kernel 版本
$ uname -r 4.1.12-1-default
发起你利用最新的系统,软件开发,软件开发,觉得一直的 bug 城市在新的 kernel 宣布中修复。
安装
openSUSE 13.2 起,自带了客栈,所以无需添加
安装 openSUSE 海内镜像源
网络原因,会见 openSUSE 速度慢且不不变,发起回收海内镜像库,下面例子是利用的 aliyun
zypper addrepo -f http://mirrors.aliyun.com/opensuse/update/leap/42.1/oss openSUSE-42.1-Update-Oss zypper addrepo -f http://mirrors.aliyun.com/opensuse/update/leap/42.1/non-oss/ openSUSE-42.1-Update-Non-Oss zypper addrepo -f http://mirrors.aliyun.com/opensuse/distribution/leap/42.1/repo/oss/ openSUSE-42.1-Oss zypper addrepo -f http://mirrors.aliyun.com/opensuse/distribution/leap/42.1/repo/non-oss/ openSUSE-42.1-Non-Oss zypper addrepo -f http://mirrors.aliyun.com/packman/openSUSE_Leap_42.1/ aliyun-packman
安装 Docker 包
$ sudo zypper in docker
输出如下:
linux-aihn:~ # zypper in docker Retrieving repository 'openSUSE-Leap-42.1-Update' metadata --------------------------[|] Warning: Digest verification failed for file '7256e9794decb02046412d2dc8ab5fa5a17875c1303f31663094da5ede29e933-app-icons.tar.gz' [/var/cache/zypp/raw/repo-updateQVITjj/repodata/7256e9794decb02046412d2dc8ab5fa5a17875c1303f31663094da5ede29e933-app-icons.tar.gz] expected 7256e9794decb02046412d2dc8ab5fa5a17875c1303f31663094da5ede29e933 but got a6be6f0868adbffa79d87856f6f3de4317a1e5c3f923be66eed899c4b559850b Accepting packages with wrong checksums can lead to a corrupted system and in extreme cases even to a system compromise. However if you made certain that the file with checksum 'a6be..' is secure, correct and should be used within this operation, enter the first 4 characters of the checksum to unblock using this file on your own risk. Empty input will discard the file. Unblock or discard? [a6be/? shows all options] (discard): discard Retrieving repository 'openSUSE-Leap-42.1-Update' metadata ......................[error] Repository 'openSUSE-Leap-42.1-Update' is invalid. [repo-update|http://download.opensuse.org/update/leap/42.1/oss/] Valid metadata not found at specified URL Please check if the URIs defined for this repository are pointing to a valid repository. Skipping repository 'openSUSE-Leap-42.1-Update' because of the above error. Loading repository data... Reading installed packages... Resolving package dependencies... The following 6 NEW packages are going to be installed: bridge-utils docker git-core git-gui gitk perl-Error 6 new packages to install. Overall download size: 10.6 MiB. Already cached: 0 B. After the operation, additional 50.7 MiB will be used. Continue? [y/n/? shows all options] (y): y Retrieving package perl-Error-0.17021-3.2.noarch (1/6), 28.3 KiB ( 49.8 KiB unpacked) Retrieving: perl-Error-0.17021-3.2.noarch.rpm ....................................[done] Retrieving package bridge-utils-1.5-21.3.x86_64 (2/6), 32.0 KiB ( 66.0 KiB unpacked) Retrieving: bridge-utils-1.5-21.3.x86_64.rpm .....................................[done] Retrieving package git-core-2.6.2-3.1.x86_64 (3/6), 3.9 MiB ( 25.7 MiB unpacked) Retrieving: git-core-2.6.2-3.1.x86_64.rpm ..........................[done (267.4 KiB/s)] Retrieving package gitk-2.6.2-3.1.x86_64 (4/6), 217.2 KiB (705.6 KiB unpacked) Retrieving: gitk-2.6.2-3.1.x86_64.rpm ............................................[done] Retrieving package git-gui-2.6.2-3.1.x86_64 (5/6), 296.1 KiB ( 1.3 MiB unpacked) Retrieving: git-gui-2.6.2-3.1.x86_64.rpm .........................................[done] Retrieving package docker-1.9.1-13.1.x86_64 (6/6), 6.2 MiB ( 22.9 MiB unpacked) Retrieving: docker-1.9.1-13.1.x86_64.rpm ...........................[done (272.8 KiB/s)] Checking for file conflicts: .....................................................[done] (1/6) Installing: perl-Error-0.17021-3.2 .........................................[done] (2/6) Installing: bridge-utils-1.5-21.3 ..........................................[done] (3/6) Installing: git-core-2.6.2-3.1 .............................................[done] (4/6) Installing: gitk-2.6.2-3.1 .................................................[done] (5/6) Installing: git-gui-2.6.2-3.1 ..............................................[done] (6/6) Installing: docker-1.9.1-13.1 ..............................................[done] Additional rpm output: creating group docker... Updating /etc/sysconfig/docker...
启动 docker 守护历程
$ sudo systemctl start docker.service
设置让 docker 处事随系统自动启动
$ sudo systemctl enable docker.service
docker 会建设一个以docker定名的用户组,添加用户到这个用户组
sudo /usr/sbin/usermod -a -G docker <username>
卸载 docker
卸载 Docker 包:
$ sudo zypper rm docker