CentOS7.8 Docker构建Nacos镜像

此处我是用的短域名的方式进行制作的Nacos镜像

1.上传对应的Nacos.tar包,并解压缩,赋予目录权限,并修改启动脚本

# 第55行  export MODE="cluster"  改为 standalone
export MODE="standalone"

2.编写dockerfile

#编写对应的dockerfile
FROM tomcat:latest
RUN mkdir -pv /home/application/nacos
COPY nacos /home/application/nacos
RUN chmod +x -R /home/application/nacos
WORKDIR /home/application
EXPOSE 33000
CMD [ "sh", "-c", "/home/application/nacos/bin/startup.sh && tail -f /home/application/nacos/logs/start.out" ]

2.通过docker build构建镜像

docker build nacos:v1.0 . 
build:构建镜像的子命令
nacos:v1.0: 制作出的镜像名称为nacos:v1.0
.: 指的是当前目录下

3.通过docker run命令进行启动nacos容器

docker run -d -p 33000:33000 -v /etc/hosts:/etc/hosts nacos:v1.0
#run:表示为启动容器,并拉取对应的镜像,如果本地没有这个镜像,将会从官方仓库拉取
#-d: 代表以守护进程方式进行运行
#--restart=always:代表如果容器宕机后,将自动重启,直到重启成功为止
#-p 33000:33000:代表将容器端口33000暴露到服务器上的33000,通过iptables进行暴露
#-v /etc/hosts:/etc/hosts: 将服务器的/etc/hosts文件进行映射到容器内的/etc/hosts
#nacos:v1.0:指定镜像名称

#下面为输出日志
/opt/java/openjdk/bin/java   -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:gc*:file=/home/application/nacos/logs/nacos_gc.log:time,tags:filecount=10,filesize=100m -Dloader.path=/home/application/nacos/plugins,/home/application/nacos/plugins/health,/home/application/nacos/plugins/cmdb,/home/application/nacos/plugins/selector -Dnacos.home=/home/application/nacos -jar /home/application/nacos/target/nacos-server.jar  --spring.config.additional-location=file:/home/application/nacos/conf/ --logging.config=/home/application/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with standalone
nacos is starting,you can check the /home/application/nacos/logs/start.out
/opt/java/openjdk/bin/java   -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:gc*:file=/home/application/nacos/logs/nacos_gc.log:time,tags:filecount=10,filesize=100m -Dloader.path=/home/application/nacos/plugins,/home/application/nacos/plugins/health,/home/application/nacos/plugins/cmdb,/home/application/nacos/plugins/selector -Dnacos.home=/home/application/nacos -jar /home/application/nacos/target/nacos-server.jar  --spring.config.additional-location=file:/home/application/nacos/conf/ --logging.config=/home/application/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288

         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 2.2.3
,`--.'`|  ' :                       ,---.               Running in stand alone mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 33000
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 33
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: http://172.17.0.2:33000/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'

2024-03-05 03:16:10,728 INFO Tomcat initialized with port(s): 33000 (http)

2024-03-05 03:16:10,853 INFO Root WebApplicationContext: initialization completed in 4717 ms

2024-03-05 03:16:30,398 INFO Adding welcome page: class path resource [static/index.html]

2024-03-05 03:16:30,949 WARN You are asking Spring Security to ignore Ant [pattern='/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-03-05 03:16:30,950 INFO Will not secure Ant [pattern='/**']

2024-03-05 03:16:30,975 INFO Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@a6c54c3, org.springframework.security.web.context.SecurityContextPersistenceFilter@2ed71727, org.springframework.security.web.header.HeaderWriterFilter@414f87a9, org.springframework.security.web.csrf.CsrfFilter@46e3559f, org.springframework.security.web.authentication.logout.LogoutFilter@62f11ebb, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@65bb6275, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@47c7a9e5, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@580fd26b, org.springframework.security.web.session.SessionManagementFilter@6e31d989, org.springframework.security.web.access.ExceptionTranslationFilter@3b83459e]

2024-03-05 03:16:31,009 INFO Exposing 1 endpoint(s) beneath base path '/actuator'

2024-03-05 03:16:31,059 INFO Tomcat started on port(s): 33000 (http) with context path '/nacos'

2024-03-05 03:16:31,087 INFO Nacos started successfully in stand alone mode. use embedded storage

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS7各个版本镜像下载地址 # CentOS7.6 下载地址 # CentOS-7-x86_64-DVD-1810.iso CentOS 7.6 DVD 版 4G http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso # CentOS-7-x86_64-Everything-1810.iso CentOS 7.6 Everything版 10G http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Everything-1810.iso # CentOS-7-x86_64-LiveGNOME-1810.iso CentOS 7.6 LiveGNOME版 1G 桌面版 http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-LiveGNOME-1810.iso # CentOS-7-x86_64-LiveKDE-1810.iso CentOS 7.6 LiveKDE版 2G 桌面版 http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-LiveKDE-1810.iso # CentOS-7-x86_64-Minimal-1810.iso CentOS 7.6 最小化版 918M http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso # CentOS-7-x86_64-NetInstall-1810.iso CentOS 7.6 网络安装版 http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-NetInstall-1810.iso # CentOS7.5 下载地址 # CentOS-7-x86_64-DVD-1804.iso CentOS 7.5 DVD 版 4G http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso # CentOS-7-x86_64-Everything-1804.iso CentOS 7.5 Everything版 10G http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-Everything-1804.iso # CentOS-7-x86_64-LiveGNOME-1804.iso CentOS 7.5 LiveGNOME版 1G 桌面版 http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-LiveGNOME-1804.iso # CentOS-7-x86_64-LiveKDE-1804.iso CentOS 7.5 LiveKDE版 2G 桌面版 http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-LiveKDE-1804.iso # CentOS-7-x86_64-Minimal-1804.iso CentOS 7.5 最小化版 918M http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-Minimal-1804.iso # CentOS-7-x86_64-NetInstall-1804.iso CentOS 7.5 网络安装版 http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-NetInstall-1804.iso    PS:另外提供国内外各大网站镜像源,也可以下载处于维护的CentOS-Linux版本镜像 开源网站镜像: 搜狐开源镜像站:http://mirrors.sohu.com/ 网易开源镜像站:http://mirrors.163.com/ 开源中国:http://mirrors.oschina.net/ 首都在线科技股份有限公司:http://mirrors.yun-idc.com/ 阿里云开源镜像:http://mirrors.aliyun.com/ LUPA:http://mirror.lupaworld.com/ 常州贝特康姆软件技术有限公司(原cn99):http://centos.bitcomm.cn/ 大学校园镜像: 中山大学镜像:http://mirror.sysu.edu.cn/ 山东理工大学:http://mirrors.sdutlinux.org/ 哈尔滨工业大学:http://run.hit.edu.cn/ 中国地质大学:http://cugbteam.org/ 大连理工大学:http://mirror.dlut.edu.cn/ 西南林业大学 http://cs3.swfu.edu.cn/cs3guide.html 北京化工大学(仅教育网可以访问),包含 CentOS 镜像:http://ubuntu.buct.edu.cn/ 天津大学:http://mirror.tju.edu.cn/ 西南大学:http://linux.swu.edu.cn/swudownload/Distributions/ 青岛大学:http://mirror.qdu.edu.cn/ 南京师范大学:http://mirrors.njnu.edu.cn/ 大连东软信息学院: http://mirrors.neusoft.edu.cn/ 浙江大学:http://mirrors.zju.edu.cn/ 兰州大学:http://mirror.lzu.edu.cn/ 厦门大学:http://mirrors.xmu.edu.cn/ 北京理工大学: http://mirror.bit.edu.cn (IPv4 only) http://mirror.bit6.edu.cn (IPv6 only) 北京交通大学: http://mirror.bjtu.edu.cn (IPv4 only) http://mirror6.bjtu.edu.cn (IPv6 only) http://debian.bjtu.edu.cn (IPv4+IPv6) 上海交通大学: http://ftp.sjtu.edu.cn/ (IPv4 only) http://ftp6.sjtu.edu.cn (IPv6 only) 清华大学: http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6) http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only) http://mirrors.4.tuna.tsinghua.edu.cn/ (IPv4 only) 中国科学技术大学: http://mirrors.ustc.edu.cn/ (IPv4+IPv6) http://mirrors4.ustc.edu.cn/ http://mirrors6.ustc.edu.cn/ 东北大学: http://mirror.neu.edu.cn/ (IPv4 only) http://mirror.neu6.edu.cn/ (IPv6 only) 华中科技大学: http://mirrors.hust.edu.cn/ http://mirrors.hustunique.com/ 电子科技大学:http://ubuntu.uestc.edu.cn/ 电子科大凝聚工作室(Raspbian单一系统镜像) http://raspbian.cnssuestc.org/ 电子科大星辰工作室(少数小众发布版镜像) http://mirrors.stuhome.net/ PyPi 镜像 豆瓣:http://pypi.douban.com/ 山东理工大学:http://pypi.sdutlinux.org/ 中山大学:http://mirror.sysu.edu.cn/pypi/ V2EX:http://pypi.v2ex.com/simple/ RubyGems 镜像 中山大学:http://mirror.sysu.edu.cn/rubygems/ 山东理工大学:http://ruby.sdutlinux.org/ 淘宝网:http://ruby.taobao.org/ npm 镜像 cnpmjs:http://cnpmjs.org/

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值