docker 安装nacos、docker 安装gitlab
1、拉取镜像
docker pull nacos/nacos-server
2、mysql新建nacos的数据库,并执行脚本 sql脚本地址如下:(切记:找对应的nacos版本的sql脚本!!!)
https://github.com/alibaba/nacos/blob/master/config/src/main/resources/META-INF/nacos-db.sql
3、挂载目录,用于映射到容器,目录按自己的情况创建
mkdir -p /mydata/nacos/logs/ #新建logs目录 mkdir -p /mydata/nacos/conf/ vim /mydata/nacos/conf/application.properties #修改配置文件
4、修改配置文件application.properties
# spring
server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}
server.contextPath=/nacos
server.port=${NACOS_APPLICATION_PORT:8848}
spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:mysql}
nacos.cmdb.dumpTaskInterval=3600
nacos.cmdb.eventTaskInterval=10
nacos.cmdb.labelTaskInterval=300
nacos.cmdb.loadDataAtStart=false
db.num=${MYSQL_DATABASE_NUM:1}
db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST:数据库ip}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME:nacos_config}?${MYSQL_SERVICE_DB_PARAM:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false}
#db.url.1=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?${MYSQL_SERVICE_DB_PARAM:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false}
db.user=${MYSQL_SERVICE_USER:root}
db.password=${MYSQL_SERVICE_PASSWORD:123456}
### The auth system to use, currently only 'nacos' is supported:
5、
方式1:启动容器,可以配置jvm内存大小,有点占用内存
docker run \ --name nacos -d \ -p 8848:8848 \ --privileged=true \ --restart=always \ -e JVM_XMS=64m \ -e JVM_XMX=64m \ -e JVM_XMN=64m \ -e MODE=standalone \ -e PREFER_HOST_MODE=hostname \ -v /mydata/nacos/logs:/home/nacos/logs \ -v /mydata/nacos/conf/application.properties:/home/nacos/conf/application.properties \ nacos/nacos-server
方式2:启动容器直接配置数据库配置
docker run -d -p 8848:8848 \--restart=always \
-e SPRING_DATASOURCE_PLATFORM=mysql \
-e MODE=standalone \
-e MYSQL_SERVICE_PORT=3306 \
-e MYSQL_SERVICE_DB_NAME=nacos_config \
-e MYSQL_SERVICE_USER=root \
-e MYSQL_SERVICE_PASSWORD=password \
-e MYSQL_SERVICE_HOST=127.0.0.1 \
--name nacos nacos/nacos-server
docker 安装gitlab
https://www.codenong.com/s1190000020934442/
docker run -d -p 2222:22 -p 8888:80 -p 8443:443
-v /mydata/gitlab/config:/etc/gitlab
-v /mydata/gitlab/logs:/var/log/gitlab
-v /mydata/gitlab/data:/var/opt/gitlab
--restart always
--name gitlab
gitlab/gitlab-ce