最小版本 nacos 在 docker 内启动的实例

NACOS 单机安装后的效果-CSDN博客

结果极好。每天早上面临「死机」的情况没有了。 

-e MODE=standalone \

docker run

docker run -d \
--name nacos \
--env-file ./nacos/custom.env \
-p 8848:8848 \
-e JVM_XMS=256m \
-e JVM_XMX=256m \
-e MODE=standalone \
--network goods-net \
nacos/nacos-server:v2.1.0-slim

custom.env

PREFER_HOST_MODE=hostname
MODE=standalone
SPRING_DATASOURCE_PLATFORM=mysql
MYSQL_SERVICE_HOST=8.12.10.123
MYSQL_SERVICE_DB_NAME=nacos
MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=root
MYSQL_SERVICE_PASSWORD=120110

⚠️

--network goods-net \

在设置 mysql 的时候一致,保持  mysql and nacos 在同一个 netwok 就能通过「docker name」访问彼此。

nacos docker单机版部署 | Nacos 官网

         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 2.1.0
,`--.'`|  ' :                       ,---.               Running in stand alone mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 8848
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 1
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: http://3a2cb639:8848/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'

2025-07-01 01:38:52,229 INFO Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@70d2e40b' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2025-07-01 01:38:52,272 INFO Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2025-07-01 01:38:54,540 INFO Tomcat initialized with port(s): 8848 (http)

2025-07-01 01:38:55,899 INFO Root WebApplicationContext: initialization completed in 24349 ms

2025-07-01 01:39:12,937 INFO Initializing ExecutorService 'applicationTaskExecutor'

2025-07-01 01:39:13,739 INFO Adding welcome page: class path resource [static/index.html]

2025-07-01 01:39:15,235 INFO Creating filter chain: Ant [pattern='/**'], []

2025-07-01 01:39:15,884 INFO Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@3e5d4f6b, org.springframework.security.web.context.SecurityContextPersistenceFilter@2d23faef, org.springframework.security.web.header.HeaderWriterFilter@5a00eb1e, org.springframework.security.web.csrf.CsrfFilter@63bde6c2, org.springframework.security.web.authentication.logout.LogoutFilter@68217d41, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@62a4417, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@4fad6218, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@39c1fe0b, org.springframework.security.web.session.SessionManagementFilter@1aac188d, org.springframework.security.web.access.ExceptionTranslationFilter@6dd82486]

2025-07-01 01:39:16,304 INFO Initializing ExecutorService 'taskScheduler'

2025-07-01 01:39:16,439 INFO Exposing 2 endpoint(s) beneath base path '/actuator'

2025-07-01 01:39:16,834 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'

2025-07-01 01:39:16,854 INFO Nacos started successfully in stand alone mode. use external storage

关于 三个端口,这里解释了

NACOS 2.0 之后端口设置为何是三个-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值