docker部署nacos2.2.1
发表于更新于
字数总计:492阅读时长:2分钟阅读量:
docker部署nacos2.2.1(单机)
1、拉取镜像
1 2
| docker search nacos docker pull nacos/nacos-server:v2.2.1
|
2、挂载目录
2.1创建挂载目录
2.2启动容器并拷贝容器目录
1 2 3 4 5 6 7
| docker run --name nacos01 -d nacos/nacos-server:v2.1.1
拷贝目录: docker cp nacos01:/home/nacos/conf /data/nacos docker cp nacos01:/home/nacos/logs /data/nacos docker cp nacos01:/home/nacos/bin /data/nacos docker cp nacos01:/home/nacos/data /data/nacos
|
2.3 删除容器
1 2
| docker stop nacos01 docker rm nacos01
|
2.4配置application.properties
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| # spring server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos} server.contextPath=/nacos server.port=${NACOS_APPLICATION_PORT:8848} server.tomcat.accesslog.max-days=30 server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false} # default current work dir server.tomcat.basedir=file:. #*************** Config Module Related Configurations *************** # #spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:} spring.sql.init.platform=mysql nacos.cmdb.dumpTaskInterval=3600 nacos.cmdb.eventTaskInterval=10 nacos.cmdb.labelTaskInterval=300 nacos.cmdb.loadDataAtStart=false db.num=1 db.url.0=jdbc:mysql://xxxxx:3306/nacos?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true db.user.0=root db.password.0=root # nacos.core.auth.system.type=nacos # # nacos.core.auth.plugin.nacos.token.expire.seconds=18000 # nacos.core.auth.plugin.nacos.token.secret.key=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg= # nacos.core.auth.caching.enabled=true nacos.core.auth.enable.userAgentAuthWhite=false nacos.core.auth.server.identity.key=example nacos.core.auth.server.identity.value=example # # nacos.security.ignore.urls=${NACOS_SECURITY_IGNORE_URLS:/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**} # metrics for elastic search management.metrics.export.elastic.enabled=false management.metrics.export.influx.enabled=false nacos.naming.distro.taskDispatchThreadCount=10 nacos.naming.distro.taskDispatchPeriod=200 nacos.naming.distro.batchSyncKeyCount=1000 nacos.naming.distro.initDataRatio=0.9 nacos.naming.distro.syncRetryDelay=5000 nacos.naming.data.warmup=true
|
2.5 挂载启动容器
1 2 3 4 5 6 7 8 9 10 11 12
| docker run \ --name nacos -d \ --privileged=true \ --restart=always \ -p 8848:8848 -p 9848:9848 \ -e MODE=standalone \ -e PREFER_HOST_MODE=hostname \ -v /data/nacos/logs:/home/nacos/logs \ -v /data/nacos/data:/home/nacos/data \ -v /data/nacos/conf:/home/nacos/conf \ -v /data/nacos/bin:/home/nacos/bin \ nacos/nacos-server:v2.2.1
|