没有JDK和Maven,用Docker也能构建Maven工程

本文涉及的产品
云数据库 Tair(兼容Redis),内存型 2GB
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
云原生网关 MSE Higress,422元/月
简介: 紧急的时候,借助Docker,在不安装JDK和Maven的环境也能构建Maven工程

欢迎访问我的GitHub

这里分类和汇总了欣宸的全部原创(含配套源码): https://github.com/zq2599/blog_demos

场景

  • 在编译构建Maven工程的时候,以下两种情况偶尔会遇到:
  1. 当前电脑上没装Maven,甚至JDK都没装;
  2. 当前电脑装了JDK8,但要用JDK7编译构建当前工程;
  • 遇到上述情况,一般会将JDK和Maven装好并设置环境变量,再去编译构建Maven工程,但如果您的电脑已装了Docker,就能利用Maven的官方镜像快速创建一个编译环境,省去在当前电脑上安装JDK和Maven的操作;

实战环境

  • 本次实战涉及的电脑操作系统和Docker版本信息如下:
  1. 电脑:Ubuntu 16.04.3 LTS
  2. Docker:17.03.2-ce

实战步骤

  • 接下来我们开始实战Docker下编译构建Maven工程,整个实战由以下两部分组成:
  1. 准备一个Maven工程;
  2. 确定要用的Maven镜像;
  3. 用Docker来编译构建Maven工程;
  4. 如何多次编译构建;

准备一个Maven工程

  1. 本次实战要编译的工程是dubbo-2.6.2,工程源码下载地址:https://codeload.github.com/apache/incubator-dubbo/zip/dubbo-2.6.2
  2. 下载的是个压缩文件:incubator-dubbo-dubbo-2.6.2.zip,解压后是个文件夹:incubator-dubbo-dubbo-2.6.2;
  3. 在我的电脑上,incubator-dubbo-dubbo-2.6.2文件夹的完整路径是:/usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2

确定要用的Maven镜像

  • 在正式编译前,要根据所需的JDK和Maven版本来决定用哪个Maven镜像;
  1. 例如本次编译的JDK我需要版本1.7,Maven我需要3.5.3版本;
  2. 浏览器打开网站:https://hub.docker.com,在顶部输入框输入"Maven",开始搜索,如下图红框:

这里写图片描述

  1. 搜索结果的第一位就是Maven的官方镜像,点击“DETAILS”按钮进入详情页,如下图红框:

这里写图片描述

  1. 详情页列出了多个JDK和Maven版本的组合,如下图红框中就是JDK1.7和Maven3.5.3的组合,红框中是对应的TAG名称是3.5.3-jdk-7,所以我们要用的镜像就是:maven:3.5.3-jdk-7

这里写图片描述

Docker下编译构建Maven工程

  • 执行以下命令即可创建Maven容器,并自动编译构建dubbo工程:
docker run -it \
--name mvn001 \
-v /usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2:/usr/src/mymaven \
-w /usr/src/mymaven maven:3.5.3-jdk-7 \
mvn clean package -U -DskipTests
  • 以上的命令中有下面几处需要注意:
  • --name mvn001:表示容器名称为mvn001;
  • -v /usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2:/usr/src/mymaven:表示将当前电脑的 /usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2目录映射到Docker容器的/usr/src/mymaven目录,也就是dubbo源码的目录
  • -w /usr/src/mymaven maven:3.5.3-jdk-7:表示容器的工作目录为/usr/src/mymaven maven:3.5.3-jdk-7;
  • mvn clean package -U -DskipTests:表示启动容器后在工作目录下执行的命令;
  • 上述docker run命令执行后,在控制台可以看到Maven工程的构建情况,我的电脑处理器是Intel i5-6300HQ,耗时16分钟40秒完成构建,部分输出信息如下:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] dubbo-parent 2.6.2 ................................. SUCCESS [04:01 min]
[INFO] Hessian Lite(Alibaba embed version) ................ SUCCESS [01:03 min]
[INFO] dubbo-common ....................................... SUCCESS [ 28.003 s]
[INFO] dubbo-container .................................... SUCCESS [  0.055 s]
[INFO] dubbo-container-api ................................ SUCCESS [  1.232 s]
[INFO] dubbo-container-spring ............................. SUCCESS [ 12.893 s]
[INFO] dubbo-container-log4j .............................. SUCCESS [  2.347 s]
[INFO] dubbo-container-logback ............................ SUCCESS [  7.851 s]
[INFO] dubbo-serialization ................................ SUCCESS [  0.038 s]
[INFO] dubbo-serialization-api ............................ SUCCESS [  1.243 s]
[INFO] dubbo-serialization-hessian2 ....................... SUCCESS [  2.962 s]
[INFO] dubbo-remoting ..................................... SUCCESS [  0.085 s]
[INFO] dubbo-remoting-api ................................. SUCCESS [  5.449 s]
[INFO] dubbo-remoting-netty ............................... SUCCESS [  6.837 s]
[INFO] dubbo-remoting-mina ................................ SUCCESS [  5.502 s]
[INFO] dubbo-remoting-grizzly ............................. SUCCESS [  9.261 s]
[INFO] dubbo-remoting-p2p ................................. SUCCESS [  2.661 s]
[INFO] dubbo-remoting-http ................................ SUCCESS [ 18.184 s]
[INFO] dubbo-remoting-zookeeper ........................... SUCCESS [ 18.372 s]
[INFO] dubbo-remoting-netty4 .............................. SUCCESS [  8.807 s]
[INFO] dubbo-rpc .......................................... SUCCESS [  0.078 s]
[INFO] dubbo-rpc-api ...................................... SUCCESS [  3.656 s]
[INFO] dubbo-rpc-dubbo .................................... SUCCESS [  3.874 s]
[INFO] dubbo-rpc-injvm .................................... SUCCESS [  2.041 s]
[INFO] dubbo-rpc-rmi ...................................... SUCCESS [  2.182 s]
[INFO] dubbo-rpc-hessian .................................. SUCCESS [  3.967 s]
[INFO] dubbo-rpc-http ..................................... SUCCESS [  3.702 s]
[INFO] dubbo-rpc-webservice ............................... SUCCESS [ 20.707 s]
[INFO] dubbo-cluster ...................................... SUCCESS [  4.267 s]
[INFO] dubbo-registry ..................................... SUCCESS [  0.035 s]
[INFO] dubbo-registry-api ................................. SUCCESS [  3.252 s]
[INFO] dubbo-monitor ...................................... SUCCESS [  0.105 s]
[INFO] dubbo-monitor-api .................................. SUCCESS [  2.197 s]
[INFO] dubbo-filter ....................................... SUCCESS [  0.038 s]
[INFO] dubbo-filter-validation ............................ SUCCESS [  2.611 s]
[INFO] dubbo-filter-cache ................................. SUCCESS [  3.488 s]
[INFO] dubbo-registry-default ............................. SUCCESS [  2.697 s]
[INFO] dubbo-monitor-default .............................. SUCCESS [  2.153 s]
[INFO] dubbo-registry-multicast ........................... SUCCESS [  2.201 s]
[INFO] dubbo-serialization-jdk ............................ SUCCESS [  2.756 s]
[INFO] dubbo-config ....................................... SUCCESS [  0.030 s]
[INFO] dubbo-config-api ................................... SUCCESS [ 14.171 s]
[INFO] dubbo-config-spring ................................ SUCCESS [  8.311 s]
[INFO] dubbo-rpc-thrift ................................... SUCCESS [ 10.473 s]
[INFO] dubbo-rpc-memcached ................................ SUCCESS [  3.533 s]
[INFO] dubbo-rpc-redis .................................... SUCCESS [  4.025 s]
[INFO] dubbo-rpc-rest ..................................... SUCCESS [ 25.898 s]
[INFO] dubbo-registry-zookeeper ........................... SUCCESS [  2.448 s]
[INFO] dubbo-registry-redis ............................... SUCCESS [ 11.810 s]
[INFO] dubbo-demo ......................................... SUCCESS [  0.045 s]
[INFO] dubbo-demo-api ..................................... SUCCESS [  0.970 s]
[INFO] dubbo-demo-provider ................................ SUCCESS [  1.461 s]
[INFO] dubbo-demo-consumer ................................ SUCCESS [  1.457 s]
[INFO] dubbo-plugin ....................................... SUCCESS [  0.037 s]
[INFO] dubbo-qos .......................................... SUCCESS [  6.069 s]
[INFO] dubbo-serialization-fastjson ....................... SUCCESS [  2.810 s]
[INFO] dubbo-serialization-kryo ........................... SUCCESS [  2.859 s]
[INFO] dubbo-serialization-fst ............................ SUCCESS [  3.499 s]
[INFO] dubbo-dependencies-bom ............................. SUCCESS [  4.641 s]
[INFO] dubbo-bom .......................................... SUCCESS [  0.009 s]
[INFO] dubbo-all .......................................... SUCCESS [05:26 min]
[INFO] dubbo-test ......................................... SUCCESS [  0.111 s]
[INFO] dubbo-test-benchmark ............................... SUCCESS [ 51.229 s]
[INFO] dubbo-test-compatibility ........................... SUCCESS [  0.103 s]
[INFO] dubbo-test-spring3 ................................. SUCCESS [  5.693 s]
[INFO] dubbo-test-integration ............................. SUCCESS [  0.203 s]
[INFO] dubbo-test-examples 2.6.2 .......................... SUCCESS [  3.866 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16:40 min
[INFO] Finished at: 2018-05-20T13:53:50Z
[INFO] ------------------------------------------------------------------------
  • 构建成功后,去当前电脑的/usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2目录下,打开每个子工程都能见到对应的target目录,以dubbo-monitor/dubbo-monitor-api为例,target中的内容如下:
root@maven:/usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2/dubbo-monitor/dubbo-monitor-api/target# pwd
/usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2/dubbo-monitor/dubbo-monitor-api/target
root@maven:/usr/local/work/dubbo262/incubator-dubbo-dubbo-2.6.2/dubbo-monitor/dubbo-monitor-api/target# ls
classes                      dubbo-monitor-api-2.6.2-sources.jar  generated-test-sources  maven-status
dubbo-monitor-api-2.6.2.jar  generated-sources                    maven-archiver          test-classes

如何多次编译构建

  • 编译Maven工程成功后,由于容器中的mvn进程不再占有终端输出,会导致容器自动停止了,执行docker ps -a可以见到容器状态如下所示:
root@maven:~# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                          PORTS               NAMES
184591657e9c        maven:3.5.3-jdk-7   "/usr/local/bin/mv..."   30 minutes ago      Exited (0) About a minute ago                       mvn001
  • 可见状态是Exited (0),容器确实停止了;
  • 那么问题来了:如果我们修改代码后要再编译构建工程,该怎么做呢?再次通过docker run命令重新创建一个容器?新的容器要重新下载所有依赖的jar包,这太慢了;
  • 试试下面的方法:
  • 执行命令docker start mvn001,将容器启动起来;
  • 执行命令docker logs -f mvn001,你会发现容器已经开始自动编译构建了,以下是正在滚动中的控制台输出:
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ dubbo-rpc-api ---
[INFO] Deleting /usr/src/mymaven/dubbo-rpc/dubbo-rpc-api/target
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ dubbo-rpc-api ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.1:prepare-agent (jacoco-initialize) @ dubbo-rpc-api ---
[INFO] jacocoArgLine set to -javaagent:/root/.m2/repository/org/jacoco/org.jacoco.agent/0.8.1/org.jacoco.agent-0.8.1-runtime.jar=destfile=/usr/src/mymaven/dubbo-rpc/dubbo-rpc-api/target/jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ dubbo-rpc-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 0 resource to META-INF/
[INFO] Copying 2 resources to META-INF/
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ dubbo-rpc-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 62 source files to /usr/src/mymaven/dubbo-rpc/dubbo-rpc-api/target/classes
[INFO]
  • 静候构建结束,如下所示,这一次耗时8分钟14秒,明显减少了:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] dubbo-parent 2.6.2 ................................. SUCCESS [  1.950 s]
[INFO] Hessian Lite(Alibaba embed version) ................ SUCCESS [  9.596 s]
[INFO] dubbo-common ....................................... SUCCESS [ 10.491 s]
[INFO] dubbo-container .................................... SUCCESS [  0.080 s]
[INFO] dubbo-container-api ................................ SUCCESS [  1.615 s]
[INFO] dubbo-container-spring ............................. SUCCESS [  2.636 s]
[INFO] dubbo-container-log4j .............................. SUCCESS [  2.465 s]
[INFO] dubbo-container-logback ............................ SUCCESS [  2.450 s]
[INFO] dubbo-serialization ................................ SUCCESS [  0.060 s]
[INFO] dubbo-serialization-api ............................ SUCCESS [  1.490 s]
[INFO] dubbo-serialization-hessian2 ....................... SUCCESS [  3.361 s]
[INFO] dubbo-remoting ..................................... SUCCESS [  0.082 s]
[INFO] dubbo-remoting-api ................................. SUCCESS [  6.229 s]
[INFO] dubbo-remoting-netty ............................... SUCCESS [  3.264 s]
[INFO] dubbo-remoting-mina ................................ SUCCESS [  2.826 s]
[INFO] dubbo-remoting-grizzly ............................. SUCCESS [  1.837 s]
[INFO] dubbo-remoting-p2p ................................. SUCCESS [  2.885 s]
[INFO] dubbo-remoting-http ................................ SUCCESS [  3.074 s]
[INFO] dubbo-remoting-zookeeper ........................... SUCCESS [  3.117 s]
[INFO] dubbo-remoting-netty4 .............................. SUCCESS [  3.162 s]
[INFO] dubbo-rpc .......................................... SUCCESS [  0.037 s]
[INFO] dubbo-rpc-api ...................................... SUCCESS [  4.591 s]
[INFO] dubbo-rpc-dubbo .................................... SUCCESS [  4.493 s]
[INFO] dubbo-rpc-injvm .................................... SUCCESS [  2.519 s]
[INFO] dubbo-rpc-rmi ...................................... SUCCESS [  2.615 s]
[INFO] dubbo-rpc-hessian .................................. SUCCESS [  2.821 s]
[INFO] dubbo-rpc-http ..................................... SUCCESS [  1.617 s]
[INFO] dubbo-rpc-webservice ............................... SUCCESS [  1.874 s]
[INFO] dubbo-cluster ...................................... SUCCESS [  5.554 s]
[INFO] dubbo-registry ..................................... SUCCESS [  0.088 s]
[INFO] dubbo-registry-api ................................. SUCCESS [  3.673 s]
[INFO] dubbo-monitor ...................................... SUCCESS [  0.053 s]
[INFO] dubbo-monitor-api .................................. SUCCESS [  2.580 s]
[INFO] dubbo-filter ....................................... SUCCESS [  0.022 s]
[INFO] dubbo-filter-validation ............................ SUCCESS [  1.583 s]
[INFO] dubbo-filter-cache ................................. SUCCESS [  2.794 s]
[INFO] dubbo-registry-default ............................. SUCCESS [  3.081 s]
[INFO] dubbo-monitor-default .............................. SUCCESS [  2.577 s]
[INFO] dubbo-registry-multicast ........................... SUCCESS [  2.492 s]
[INFO] dubbo-serialization-jdk ............................ SUCCESS [  3.903 s]
[INFO] dubbo-config ....................................... SUCCESS [  0.046 s]
[INFO] dubbo-config-api ................................... SUCCESS [  4.661 s]
[INFO] dubbo-config-spring ................................ SUCCESS [  5.146 s]
[INFO] dubbo-rpc-thrift ................................... SUCCESS [  6.081 s]
[INFO] dubbo-rpc-memcached ................................ SUCCESS [  1.538 s]
[INFO] dubbo-rpc-redis .................................... SUCCESS [  1.696 s]
[INFO] dubbo-rpc-rest ..................................... SUCCESS [  2.224 s]
[INFO] dubbo-registry-zookeeper ........................... SUCCESS [  2.971 s]
[INFO] dubbo-registry-redis ............................... SUCCESS [  2.872 s]
[INFO] dubbo-demo ......................................... SUCCESS [  0.064 s]
[INFO] dubbo-demo-api ..................................... SUCCESS [  1.197 s]
[INFO] dubbo-demo-provider ................................ SUCCESS [  1.849 s]
[INFO] dubbo-demo-consumer ................................ SUCCESS [  1.662 s]
[INFO] dubbo-plugin ....................................... SUCCESS [  0.028 s]
[INFO] dubbo-qos .......................................... SUCCESS [  3.424 s]
[INFO] dubbo-serialization-fastjson ....................... SUCCESS [  3.242 s]
[INFO] dubbo-serialization-kryo ........................... SUCCESS [  3.567 s]
[INFO] dubbo-serialization-fst ............................ SUCCESS [  3.159 s]
[INFO] dubbo-dependencies-bom ............................. SUCCESS [  0.079 s]
[INFO] dubbo-bom .......................................... SUCCESS [  0.011 s]
[INFO] dubbo-all .......................................... SUCCESS [05:16 min]
[INFO] dubbo-test ......................................... SUCCESS [  0.143 s]
[INFO] dubbo-test-benchmark ............................... SUCCESS [ 12.323 s]
[INFO] dubbo-test-compatibility ........................... SUCCESS [  0.087 s]
[INFO] dubbo-test-spring3 ................................. SUCCESS [  1.665 s]
[INFO] dubbo-test-integration ............................. SUCCESS [  0.146 s]
[INFO] dubbo-test-examples 2.6.2 .......................... SUCCESS [  4.511 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:14 min
[INFO] Finished at: 2018-05-20T14:36:42Z
[INFO] ------------------------------------------------------------------------
  • docker ps -a命令查看容器状态,再次停止了;
  • 去工程的target目录下,里面有最新构建的工程结果;
  • 小结:每次构建完成容器会自动停止,用docker start命令启动容器后会自动开始构建;
  • 以上就是Docker下通过Maven容器构建工程的全部实战内容,如果您遇到没有JDK或者不想变动JDK版本的情况,可以找一台有Docker的电脑,用上述方法来快速构建工程;
  • 另外提醒一句:pom.xml文件中一般会配置JDK的版本,这个版本号要和Maven镜像中的JDK版本一致,否则编译期间会报错;

欢迎关注阿里云开发者社区博客:程序员欣宸

学习路上,你不孤单,欣宸原创一路相伴...
相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
15天前
|
运维 Kubernetes Docker
利用Docker和Kubernetes构建微服务架构
利用Docker和Kubernetes构建微服务架构
|
2月前
|
负载均衡 网络协议 开发者
掌握 Docker 网络:构建复杂的容器通信
在 Docker 容器化环境中,容器间的通信至关重要。本文详细介绍了 Docker 网络的基本概念和类型,包括桥接网络、宿主网络、覆盖网络和 Macvlan 网络等,并提供了创建、管理和配置自定义网络的实用命令。通过掌握这些知识,开发者可以构建更健壮和灵活的容器化应用,提高应用的可扩展性和安全性。
|
21天前
|
存储 监控 Linux
docker构建镜像详解!!!
本文回顾了Docker的基本命令和管理技巧,包括容器和镜像的增删改查操作,容器的生命周期管理,以及如何通过端口映射和数据卷实现容器与宿主机之间的网络通信和数据持久化。文章还详细介绍了如何使用Docker部署一个简单的Web应用,并通过数据卷映射实现配置文件和日志的管理。最后,文章总结了如何制作自定义镜像,包括Nginx、Python3和CentOS镜像,以及如何制作私有云盘镜像。
100 2
|
29天前
|
Kubernetes 负载均衡 Docker
构建高效微服务架构:Docker与Kubernetes的完美搭档
本文介绍了Docker和Kubernetes在构建高效微服务架构中的应用,涵盖基本概念、在微服务架构中的作用及其实现方法。通过具体实例,如用户服务、商品服务和订单服务,展示了如何利用Docker和Kubernetes实现服务的打包、部署、扩展及管理,确保微服务架构的稳定性和可靠性。
82 7
|
28天前
|
Kubernetes 负载均衡 Docker
构建高效微服务架构:Docker与Kubernetes的完美搭档
【10月更文挑战第22天】随着云计算和容器技术的快速发展,微服务架构逐渐成为现代企业级应用的首选架构。微服务架构将一个大型应用程序拆分为多个小型、独立的服务,每个服务负责完成一个特定的功能。这种架构具有灵活性、可扩展性和易于维护的特点。在构建微服务架构时,Docker和Kubernetes是两个不可或缺的工具,它们可以完美搭档,为微服务架构提供高效的支持。本文将从三个方面探讨Docker和Kubernetes在构建高效微服务架构中的应用:一是Docker和Kubernetes的基本概念;二是它们在微服务架构中的作用;三是通过实例讲解如何使用Docker和Kubernetes构建微服务架构。
59 6
|
27天前
|
负载均衡 应用服务中间件 nginx
基于Nginx和Consul构建自动发现的Docker服务架构——非常之详细
通过使用Nginx和Consul构建自动发现的Docker服务架构,可以显著提高服务的可用性、扩展性和管理效率。Consul实现了服务的自动注册与发现,而Nginx则通过动态配置实现了高效的反向代理与负载均衡。这种架构非常适合需要高可用性和弹性扩展的分布式系统。
28 4
|
28天前
|
负载均衡 应用服务中间件 nginx
基于Nginx和Consul构建自动发现的Docker服务架构——非常之详细
通过使用Nginx和Consul构建自动发现的Docker服务架构,可以显著提高服务的可用性、扩展性和管理效率。Consul实现了服务的自动注册与发现,而Nginx则通过动态配置实现了高效的反向代理与负载均衡。这种架构非常适合需要高可用性和弹性扩展的分布式系统。
36 3
|
1月前
|
jenkins 测试技术 持续交付
Docker最佳实践:构建高效的CI/CD流水线
【10月更文挑战第17天】在现代软件开发实践中,持续集成(Continuous Integration, CI)和持续部署(Continuous Deployment, CD)已成为提高开发效率和软件质量的重要手段。Docker作为一种容器技术,为构建一致且隔离的开发环境提供了强有力的支撑。本文将探讨如何利用Docker来优化CI/CD流程,包括构建环境的标准化、镜像管理以及与CI/CD工具(如Jenkins、GitLab CI)的集成。
52 5
|
1月前
|
JavaScript Docker Python
下个时代的开发工具-Nix:声明式的运行环境构建器、简单场景下的docker替身
Nix 是一个独特的包管理工具和构建系统,采用声明式方法管理软件包和运行环境。它通过精确控制依赖关系和环境配置,确保软件的可重复性、隔离性和可追溯性。Nix 支持多语言开发环境,提供声明式配置、环境隔离、回滚与版本控制等核心功能,适用于复杂开发场景,有效解决依赖冲突和环境不一致问题。
|
15天前
|
API Docker 容器
【赵渝强老师】构建Docker Swarm集群
本文介绍了如何使用三台虚拟主机构建Docker Swarm集群。首先在master节点上初始化集群,然后通过特定命令将node1和node2作为worker节点加入集群。最后,在master节点上查看集群的节点信息,确认集群构建成功。文中还提供了相关图片和视频教程,帮助读者更好地理解和操作。
下一篇
无影云桌面