今天就跟大家聊聊有關(guān)Docker怎么在openSUSE 下的安裝、使用,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
創(chuàng)新互聯(lián)是一家專業(yè)提供吳中企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、H5頁面制作、小程序制作等業(yè)務(wù)。10年已為吳中眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。
Docker 在 openSUSE 環(huán)境下的詳細(xì)安裝過程,并嘗試運(yùn)行一個(gè)簡(jiǎn)單 Spring Boot 的 image 來感受下 Docker 的風(fēng)采。
Docker 是為開發(fā)人員和系統(tǒng)管理員用于構(gòu)建、發(fā)布、并運(yùn)行分布式應(yīng)用程序的開放式平臺(tái)。該平臺(tái)由 Docker 引擎(一個(gè)便攜、輕巧的運(yùn)行時(shí)和打包工具) 和 Docker Hub (一個(gè)共享應(yīng)用程序和自動(dòng)化工作流的云服務(wù))等組成。Docker 可以使應(yīng)用程序從組件迅速組裝并消除了開發(fā)、質(zhì)量保證和生產(chǎn)環(huán)境之間的摩擦問題。這樣一來,IT部門可以更快地發(fā)布,而這些應(yīng)用程序不管是運(yùn)行在筆記本電腦、數(shù)據(jù)中心的虛擬機(jī),還是任何的云,其運(yùn)行過程和結(jié)果都是一致的。
更多有關(guān) Docker 的介紹,可以參閱《簡(jiǎn)述 Docker》 一文。
64-bit 系統(tǒng)
kernel 3.10+
openSUSE 13.2+。本例使用的是 openSUSE Leap 42.1(如果你沒有 openSUSE 系統(tǒng),可以嘗試在虛擬機(jī)里面裝個(gè) openSUSE 系統(tǒng),可以參閱《Oracle VM VirtualBox 安裝和使用》《CentOS 7 安裝、配置》)
使用 uname -r
檢查 kernel 版本
$ uname -r 4.1.12-1-default
建議你使用最新的系統(tǒng),以為一直的 bug 都會(huì)在新的 kernel 發(fā)布中修復(fù)。
openSUSE 13.2 起,自帶了倉(cāng)庫,所以無需添加
網(wǎng)絡(luò)原因,訪問 openSUSE 速度慢且不穩(wěn)定,建議采用國(guó)內(nèi)鏡像庫,下面例子是使用的 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
$ 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...
$ sudo systemctl start docker.service
$ sudo systemctl enable docker.service
docker 會(huì)創(chuàng)建一個(gè)以docker
命名的用戶組,添加用戶到這個(gè)用戶組
sudo /usr/sbin/usermod -a -G docker <username>
卸載 Docker 包:
$ sudo zypper rm docker
上述命令不會(huì)卸載 images、containers、volumes, 或者用戶創(chuàng)建在主機(jī)的配置文件。若想卸載干凈上述所有 images、containers、volumes, 執(zhí)行:
$ rm -rf /var/lib/docker
用戶創(chuàng)建在主機(jī)的配置文件需手動(dòng)刪除。
可以將 Docker Bub 存儲(chǔ)的 image 拉取到本地,執(zhí)行
docker pull waylau/docker-spring-boot
輸出如下:
linux-aihn:~ # docker pull waylau/docker-spring-boot Using default tag: latest Pulling repository docker.io/waylau/docker-spring-boot 3694bcee2712: Download complete a2e9c1527ca5: Download complete 20f4b5a54fc6: Download complete 7a220626bc9e: Download complete 620bbe9b8954: Download complete a0b5e5298dc5: Download complete 2f8558117280: Download complete d2ee7992d027: Download complete Status: Downloaded newer image for waylau/docker-spring-boot:latest docker.io/waylau/docker-spring-boot: this image was pulled from a legacy registry. Important: This registry version will not be supported in future versions of docker.
執(zhí)行:
docker run -p 8080:8080 -t waylau/docker-spring-boot
最后成功的界面如下:
linux-aihn:~ # docker run -p 8080:8080 -t waylau/docker-spring-boot . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.3.3.RELEASE) 2016-03-31 02:33:53.043 INFO 1 --- [ main] c.waylau.docker_spring_boot.Application : Starting Application v1.0.0 on 5dfa67f23534 with PID 1 (/app.jar started by root in /) 2016-03-31 02:33:53.096 INFO 1 --- [ main] c.waylau.docker_spring_boot.Application : No active profile set, falling back to default profiles: default 2016-03-31 02:33:55.050 INFO 1 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@64dac4db: startup date [Thu Mar 31 02:33:54 GMT 2016]; root of context hierarchy 2016-03-31 02:34:03.254 INFO 1 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]] 2016-03-31 02:34:11.228 INFO 1 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2016-03-31 02:34:11.424 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2016-03-31 02:34:11.440 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.32 2016-03-31 02:34:12.574 INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2016-03-31 02:34:12.575 INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 17670 ms 2016-03-31 02:34:16.786 INFO 1 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2016-03-31 02:34:16.839 INFO 1 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2016-03-31 02:34:16.842 INFO 1 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2016-03-31 02:34:16.867 INFO 1 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2016-03-31 02:34:16.868 INFO 1 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2016-03-31 02:34:20.432 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@64dac4db: startup date [Thu Mar 31 02:33:54 GMT 2016]; root of context hierarchy 2016-03-31 02:34:21.405 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public java.lang.String com.waylau.docker_spring_boot.Application.home() 2016-03-31 02:34:21.451 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2016-03-31 02:34:21.457 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2016-03-31 02:34:22.033 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-03-31 02:34:22.037 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-03-31 02:34:22.658 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-03-31 02:34:23.787 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2016-03-31 02:34:24.497 INFO 1 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2016-03-31 02:34:24.567 INFO 1 --- [ main] c.waylau.docker_spring_boot.Application : Started Application in 39.766 seconds (JVM running for 46.766)
如果程序正確運(yùn)行,瀏覽器訪問 http://localhost:8080/,可以看到頁面 “Hello Docker World.” 字樣。
可以看到 pull 回來的這個(gè) image 的一個(gè)情況、大小等信息。
linux-aihn:~ # docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE waylau/docker-spring-boot latest 3694bcee2712 10 days ago 180.8 MB
看完上述內(nèi)容,你們對(duì)Docker怎么在openSUSE 下的安裝、使用有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。
網(wǎng)站標(biāo)題:Docker怎么在openSUSE下的安裝、使用
文章起源:http://jinyejixie.com/article24/iishje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、域名注冊(cè)、小程序開發(fā)、營(yíng)銷型網(wǎng)站建設(shè)、網(wǎng)站營(yíng)銷、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)