dockerfile-maven-plugin极简教程
一、简介
maven是一个项目依赖管理和构建的工具,dockerfile-maven-plugin是一个maven的插件,主要作用是在项目构建的时候生成基于项目的docker镜像文件。
简而言之,此插件将maven和docker进行集成。
正常情况下,我们在开发了一个应用程序后,会使用maven进行打包,生成对应的jar文件。而后,会使用docker将jar文件build成一个镜像(docker image)。之后,就可以在docker daemon中创建基于镜像的容器,并可提供服务了。
dockerfile-maven-plugin的目标就是将maven的打包过程和docker的build过程结合在一起,当成功打包,既生成了对应的jar,也已生成了对应的docker镜像。当然,这只是最基础的功能,更详细的功能参见:https://github.com/spotify/dockerfile-maven
二、概述
我们知道maven是apache公司开发的一个产品,但是dockerfile-maven-plugin并不是apache官方开发的插件,是由一个叫做Spotify的组织开发的。
github主页:https://spotify.github.io/
github开源地址:https://github.com/spotify/dockerfile-maven
本文仅讨论如何基于一个Spring Boot的项目生成对应的docker镜像。
基本的原理如下:
- 首先,dockerfile-maven-plugin插件已经存储在maven的仓库中
- 然后,当在本地开发的时候,需要在项目的pom文件中引入此插件,在pom-build-plugins下面增加plugin配置节点
- 再然后,在executions节点中配置此插件如何工作;并且在configuration节点中加入需要的配置信息
- 最后,当我们执行mvn package的时候就可以得到docker image 了
环境:
- Ideal版本:2020.01
- java版本:8
- maven版本:3.6.1
- docker版本:19.03.12
ideal和docker deamon运行在同一台机器上面
三、将spring-boot-app打包成docker镜像
创建示例应用
使用ideal自带的Spring Initializr生成一个Spring Web 的示例项目
app对外提供一个hello的接口,访问该接口可以得到Hello,World的响应结果。应用主启动类代码如下:
package com.naylor.dockerfilemavenplugin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/")
@SpringBootApplication
public class DockerfileMavenPluginApplication {
public static void main(String[] args) {
SpringApplication.run(DockerfileMavenPluginApplication.class, args);
}
@GetMapping("/hello")
public String hello(){
return "Hello,World";
}
}
编译并运行项目,在浏览器中访问「http://127.0.0.1:8080/hello」 可以得到预期的响应结果
修改pom文件
在pom中增加对dockerfile-maven-plugin插件的引用,核心代码如下:
<!-- dockerfile-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>com.naylor/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
其中:
g,a,v 为对插件的引用
executions中的build标识,在maven的packege环节执行此插件
configuration中的repository是生成的镜像的repository信息
tag为镜像的tag信息
buildArgs是在docker构建镜像过程中的参数,此处定义的JAR_FILE参数在执行docker build 的时候会消费
完整的pom文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.naylor</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>dockerfile-maven-plugin</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- dockerfile-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>com.naylor/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
增加Dockerfile文件
在项目根目录(和pom文件在同一级)新建一个Dokerfile文件,文件内容如下:
FROM java:8
EXPOSE 8080
ARG JAR_FILE
ADD target/${JAR_FILE} /app.jar
ENTRYPOINT ["java", "-jar","/app.jar"]
使用Maven打包应用
首先清理一下maven工程,在ideal的Maven面版中点击Lifecycle-clean或者使用命令行执行mvn clean。
然后,使用maven构建app,在ideal的Maven面版中点击Liftcycle-package或者使用命令行执行 mvn package
再然后在命令行工具中执行docker image ls ,如果不出意外,可以看到一个repository为com.naylor/dockerfile-maven-plugin的docker镜像。
运行应用镜像
在命令行工具中执行如下命令运行容器:
docker run -d -p 8081:8080 ImageId
- ImageId为上一步生成的镜像的id,每次生成的镜像id都不一样
- 此命令作用为基于ImageId构建一个容器,将宿主机的8081端口映射到容器的8080端口
在宿主机浏览器中访问「http://127.0.0.1:8081/hello」可以得到Hello,World的响应。
四、分析mvn package 命令的控制台输出
通过mvn package的控制台输出,我们可以清晰的观察到整个流程的执行步骤,完整的输出如下:
/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/chenhd/code/DebrisApp_Springboot/debris-app "-Dmaven.home=/Applications/IntelliJ IDEA 2.app/Contents/plugins/maven/lib/maven3" "-Dclassworlds.conf=/Applications/IntelliJ IDEA 2.app/Contents/plugins/maven/lib/maven3/bin/m2.conf" "-Dmaven.ext.class.path=/Applications/IntelliJ IDEA 2.app/Contents/plugins/maven/lib/maven-event-listener.jar" "-javaagent:/Applications/IntelliJ IDEA 2.app/Contents/lib/idea_rt.jar=58649:/Applications/IntelliJ IDEA 2.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 2.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar" org.codehaus.classworlds.Launcher -Didea.version2020.1 package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.naylor:dockerfile-maven-plugin >-----------------
[INFO] Building dockerfile-maven-plugin 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ dockerfile-maven-plugin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ dockerfile-maven-plugin ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ dockerfile-maven-plugin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/chenhd/code/DebrisApp_Springboot/debris-app/dockerfile-maven-plugin/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ dockerfile-maven-plugin ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ dockerfile-maven-plugin ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests
13:49:50.713 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
13:49:50.735 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
13:49:50.762 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
13:49:50.781 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests], using SpringBootContextLoader
13:49:50.785 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests]: class path resource [com/naylor/dockerfilemavenplugin/DockerfileMavenPluginApplicationTests-context.xml] does not exist
13:49:50.785 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests]: class path resource [com/naylor/dockerfilemavenplugin/DockerfileMavenPluginApplicationTestsContext.groovy] does not exist
13:49:50.785 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
13:49:50.786 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests]: DockerfileMavenPluginApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
13:49:50.826 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests]
13:49:50.926 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/Users/chenhd/code/DebrisApp_Springboot/debris-app/dockerfile-maven-plugin/target/classes/com/naylor/dockerfilemavenplugin/DockerfileMavenPluginApplication.class]
13:49:50.932 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplication for test class com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests
13:49:51.069 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests]: using defaults.
13:49:51.070 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
13:49:51.096 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
13:49:51.098 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
13:49:51.098 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@5acf93bb, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7e7be63f, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@6cd28fa7, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@614ca7df, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4738a206, org.springframework.test.context.event.EventPublishingTestExecutionListener@66d3eec0, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@1e04fa0a, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@1af2d44a, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@18d87d80, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@618425b5, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@58695725, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@543588e6]
13:49:51.114 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@209da20d testClass = DockerfileMavenPluginApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@e15b7e8 testClass = DockerfileMavenPluginApplicationTests, locations = '{}', classes = '{class com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@27ae2fd0, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@4278a03f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2bbf180e, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@96def03, org.springframework.boot.test.context.SpringBootTestArgs@1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
13:49:51.152 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.4.RELEASE)
2020-10-12 13:49:51.449 INFO 16693 --- [ main] .d.DockerfileMavenPluginApplicationTests : Starting DockerfileMavenPluginApplicationTests on neiyo with PID 16693 (started by chenhd in /Users/chenhd/code/DebrisApp_Springboot/debris-app/dockerfile-maven-plugin)
2020-10-12 13:49:51.451 INFO 16693 --- [ main] .d.DockerfileMavenPluginApplicationTests : No active profile set, falling back to default profiles: default
2020-10-12 13:49:52.458 INFO 16693 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-10-12 13:49:52.732 INFO 16693 --- [ main] .d.DockerfileMavenPluginApplicationTests : Started DockerfileMavenPluginApplicationTests in 1.559 seconds (JVM running for 2.86)
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.313 s - in com.naylor.dockerfilemavenplugin.DockerfileMavenPluginApplicationTests
2020-10-12 13:49:53.042 INFO 16693 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ dockerfile-maven-plugin ---
[INFO] Building jar: /Users/chenhd/code/DebrisApp_Springboot/debris-app/dockerfile-maven-plugin/target/dockerfile-maven-plugin-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.4.RELEASE:repackage (repackage) @ dockerfile-maven-plugin ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- dockerfile-maven-plugin:1.3.6:build (default) @ dockerfile-maven-plugin ---
[INFO] Building Docker context /Users/chenhd/code/DebrisApp_Springboot/debris-app/dockerfile-maven-plugin
[INFO]
[INFO] Image will be built as com.naylor/dockerfile-maven-plugin:0.0.1-SNAPSHOT
[INFO]
[INFO] Step 1/5 : FROM java:8
[INFO]
[INFO] Pulling from library/java
[INFO] Digest: sha256:c1ff613e8ba25833d2e1940da0940c3824f03f802c449f3d1815a66b7f8c0e9d
[INFO] Status: Image is up to date for java:8
[INFO] ---> d23bdf5b1b1b
[INFO] Step 2/5 : EXPOSE 8080
[INFO]
[INFO] ---> Using cache
[INFO] ---> 75767466e0be
[INFO] Step 3/5 : ARG JAR_FILE
[INFO]
[INFO] ---> Using cache
[INFO] ---> 2ecdd1234dc2
[INFO] Step 4/5 : ADD target/${JAR_FILE} /app.jar
[INFO]
[INFO] ---> 6169104a5073
[INFO] Step 5/5 : ENTRYPOINT ["java", "-jar","/app.jar"]
[INFO]
[INFO] ---> Running in 23596d4612b6
[INFO] Removing intermediate container 23596d4612b6
[INFO] ---> 993715a0e72a
[INFO] Successfully built 993715a0e72a
[INFO] Successfully tagged com.naylor/dockerfile-maven-plugin:0.0.1-SNAPSHOT
[INFO]
[INFO] Detected build of image with id 993715a0e72a
[INFO] Building jar: /Users/chenhd/code/DebrisApp_Springboot/debris-app/dockerfile-maven-plugin/target/dockerfile-maven-plugin-0.0.1-SNAPSHOT-docker-info.jar
[INFO] Successfully built com.naylor/dockerfile-maven-plugin:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.597 s
[INFO] Finished at: 2020-10-12T13:50:03+08:00
[INFO] ------------------------------------------------------------------------
重点分析一下如下日志:
--- dockerfile-maven-plugin:1.3.6:build (default) @ dockerfile-maven-plugin ---
Building Docker context /Users/chenhd/code/DebrisApp_Springboot/debris-app/dockerfile-maven-plugin
执行dockerfile-maven-plugin项目的docker上下文的构建
Image will be built as com.naylor/dockerfile-maven-plugin:0.0.1-SNAPSHOT
构建完成之后镜像的名称为:com.naylor/dockerfile-maven-plugin:0.0.1-SNAPSHOT
Step 1/5 : FROM java:8
dockerfile中一共定义了5步来执行构建,第一步是拉取java8的镜像,如果本地没有会从远程仓库中搜索并下载下来
Successfully tagged com.naylor/dockerfile-maven-plugin:0.0.1-SNAPSHOT
成功打包了镜像
引用
1:官网:https://github.com/spotify/dockerfile-maven
2:dockerfile参考:https://docs.docker.com/engine/reference/builder/
dockerfile-maven-plugin极简教程的更多相关文章
- Typora极简教程
Typora极简教程 ” Markdown 是一种轻量级标记语言,创始人是约翰·格鲁伯(John Gruber).它允许人们 “使用易读易写的纯文本格式编写文档,然后转换成有效的 HTML 文档.” ...
- CentOS安装使用.netcore极简教程(免费提供学习服务器)
本文目标是指引从未使用过Linux的.Neter,如何在CentOS7上安装.Net Core环境,以及部署.Net Core应用. 仅针对CentOS,其它Linux系统类似,命令环节稍加调整: 需 ...
- Asky极简教程:零基础1小时学编程,已更新前8节
Asky极简架构 开源Asky极简架构.超轻量级.高并发.水平扩展.微服务架构 <Asky极简教程:零基础1小时学编程>开源教程 零基础入门,从零开始全程演示,如何开发一个大型互联网系统, ...
- Python 极简教程(八)字符串 str
由于字符串过于重要,请认真看完并保证所有代码都至少敲过一遍. 对于字符串,前面在数据类型中已经提到过.但是由于字符串类型太过于常用,Python 中提供了非常多的关于字符串的操作.而我们在实际编码过程 ...
- Nginx 极简教程(快速入门)
作者:dunwu github.com/dunwu/nginx-tutorial 推荐阅读(点击即可跳转阅读) 1. SpringBoot内容聚合 2. 面试题内容聚合 3. 设计模式内容聚合 4. ...
- 【转】Typora极简教程
Typora极简教程 Typora download ” Markdown 是一种轻量级标记语言,创始人是约翰·格鲁伯(John Gruber).它允许人们 “使用易读易写的纯文本格式编写文档,然后转 ...
- nginx极简教程
Nginx 极简教程 本项目是一个 Nginx 极简教程,目的在于帮助新手快速入门 Nginx. examples 目录中的示例模拟了工作中的一些常用实战场景,并且都可以通过脚本一键式启动,让您可以快 ...
- NodeJS 极简教程 <1> NodeJS 特点 & 使用场景
NodeJS 极简教程 <1> NodeJS 特点 & 使用场景 田浩 因为看开了所以才去较劲儿. 1. NodeJS是什么 1.1 Node.js is a JavaScri ...
- 自制 os 极简教程1:写一个操作系统有多难
为什么叫极简教程呢?听我慢慢说 不知道正在阅读本文的你,是否是因为想自己动手写一个操作系统.我觉得可能每个程序员都有个操作系统梦,或许是想亲自动手写出来一个,或许是想彻底吃透操作系统的知识.不论是为了 ...
- python极简教程04:进程和线程
测试奇谭,BUG不见. 大家好,我是谭叔. 这一场,主讲python的进程和线程. 目的:掌握初学必须的进程和线程知识. 进程和线程的区别和联系 终于开始加深难度,来到进程和线程的知识点~ 单就这两个 ...
随机推荐
- OpenJ_Bailian - 2995-登山(两遍最长上升子序列+枚举顶点)
五一到了,PKU-ACM队组织大家去登山观光,队员们发现山上一个有N个景点,并且决定按照顺序来浏览这些景点,即每次所浏览景点的编号都要大于前一个浏览景点的编号.同时队员们还有另一个登山习惯,就是不连续 ...
- P1004 方格取数(四维动态规划)
题目描述 设有N \times NN×N的方格图(N \le 9)(N≤9),我们将其中的某些方格中填入正整数,而其他的方格中则放入数字00.如下图所示(见样例): A 0 0 0 0 0 0 0 0 ...
- 平衡二叉搜索树/AVL二叉树 C实现
//AVTree.h #ifndef MY_AVLTREE_H #define MY_AVLTREE_H typedef int ElementType; struct TreeNode { Elem ...
- 一句Delete..In.. 删除语句的优化
实验环境: # 类别 版本 1 操作系统 Win10 2 数据库 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit P ...
- 车联网容器应用探索:5G下边缘云计算的车路协同实践
导语 | 5G网络下,多接入边缘计算(MEC)应运而生.结合TKEStack强大的集群管理能力和异构计算资源管理能力,腾讯打造了一个功能完备的边缘计算PaaS平台TMEC,提供了高精确度定位.视频处理 ...
- Linux实战(14):Ubuntu修改root默认登陆
第一步 首先登录系统,创建root用户的密码 在终端输入命令: sudo passwd root 然后输入设置的密码,这样就完成了设置root用户密码的步骤 第二步 修改文件 sudo nano /u ...
- pxe+kickstart无人值守批量安装linux
一.原理和概念: 1.PXE: PXE 并不是一种安装方式,而是一种引导的方式.进行 PXE 安装的必要条件是要安装的计算机中包含一个 PXE 支持的网卡(NIC),即网卡中必须要有 ...
- Infor EAM:注重行业属性,实现对轨道交通线性资产的可视化管理
Infor EAM:注重行业属性,实现对轨道交通线性资产的可视化管理 企业得利,一要开源,二要节流.而企业资产管理的目的,也正是从资产的角度出发,一方面通过相关资源与活动的合理安排提高设备可利用率.增 ...
- nacos快速安装
一 什么是 Nacos 服务注册中心和配置中心. 二 使用 下载和启动 使用有两种方式 1.自己下载源码编译 2.下载编译好的压缩包 我比较懒选择了第二种方式. 最新稳定版本 下载地址:https:/ ...
- .NET Core加解密实战系列之——使用BouncyCastle制作p12(.pfx)数字证书
简介 加解密现状,编写此系列文章的背景: 需要考虑系统环境兼容性问题(Linux.Windows) 语言互通问题(如C#.Java等)(加解密本质上没有语言之分,所以原则上不存在互通性问题) 网上资料 ...