Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy nacos with docker

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Today, the editor will share with you the relevant knowledge points about how to deploy nacos with docker. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Deploy nacos1 in docker mode, pull nacos image and start docker pull nacos/nacos-server

2 launch the nacos command docker run-d-- name nacos- p 8848 PREFER_HOST_MODE=hostname-e MODE=standalone nacos/nacos-server

At this point, we can use the nacos service, UI address: http://:8848/nacos account: nacos password: nacos

The above method is the easiest way to start, but there is a slight flaw that all nacos metadata will be stored inside the container. If the container is migrated, the nacos source data no longer exists, so we usually save the nacos metadata in mysql. The configuration method is attached below:

3 modify the configuration file # 1 to view the docker container, nacos started successfully docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES8149bca96437 nacos/nacos-server "bin/docker-startup." 4 minutes ago Up About a minute 0.0.0.0 docker exec 8848-> 8848/tcp nacos#2 enter the container docker exec-it 8149bca96437 / bin/bash#3 modify the conf/application.properties content as follows: vi conf/application.properties

Database script

Nacos-db.sql

Replace the application.properties content with

# springserver.contextPath=/nacosserver.servlet.contextPath=/nacosserver.port=8848management.metrics.export.elastic.enabled=falsemanagement.metrics.export.influx.enabled=falseserver.tomcat.accesslog.enabled=trueserver.tomcat.accesslog.pattern=%h l u t'r's b D {User-Agent} iserver.tomcat.basedir=nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png / * / * .ico, / console-fe/public/**,/v1/auth/login,/v1/console/health/**,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/** / v1/console/server/**spring.datasource.platform=mysqldb.num=1db.url.0=jdbc:mysql://:/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=truedb.user=rootdb.password=password4 exit Container exit5 restart Container docker restart 8149bca96437 these are all the contents of the article "how to deploy nacos in docker" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report