| Id |
Title |
Content |
Published |
Framework Id |
User Id |
Created |
Modified |
Actions |
| 7 |
Ubuntu24.04安装docker |
<p>1、下载地址:https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/</p>
<p> </p>
<p>2、选择对应平台:</p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>amd64是x86平台</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>arm64是arm平台</span></p>
<p> </p>
<p><span style="white-space: normal;">3、</span>需要下载的软件包</p>
<p>必要下载</p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>containerd.io_1.7.27-1_amd64.deb #它是Docker引擎的核心底层组件,负责管理容器的整个生命周期</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>docker-buildx-plugin_0.25.0-1~ubuntu.24.04~noble_amd64.deb #提供buildx插件</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>docker-ce-cli_28.3.1-1~ubuntu.24.04~noble_amd64.deb #提供Docker 命令行接口</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>docker-ce_28.3.1-1~ubuntu.24.04~noble_amd64.deb #Docker社区版核心引擎包</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>docker-compose-plugin_2.38.1-1~ubuntu.24.04~noble_amd64.deb #Docker Compose组件包</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>可选下载</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>docker-ce-rootless-extras_28.3.1-1~ubuntu.24.04~noble_amd64.deb #允许非root用户启动并运行Docker的组件</span></p>
<p> </p>
<p>4、服务器自动下载(与上面步骤选一个就行)</p>
<pre class=""><code class="language-bash hljs">sudo cat > docker_wget.txt <<EOF
https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/amd64/containerd.io_1.7.27-1_amd64.deb
https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/amd64/docker-buildx-plugin_0.25.0-1~ubuntu.24.04~noble_amd64.deb
https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/amd64/docker-ce-cli_28.3.1-1~ubuntu.24.04~noble_amd64.deb
https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/amd64/docker-ce_28.3.1-1~ubuntu.24.04~noble_amd64.deb
https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/amd64/docker-compose-plugin_2.38.1-1~ubuntu.24.04~noble_amd64.deb
https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/amd64/docker-ce-rootless-extras_28.3.1-1~ubuntu.24.04~noble_amd64.deb
EOF
sudo wget -c -i docker_wget.txt</code></pre>
<p> </p>
<p>5、安装</p>
<pre class=""><code class="language-bash hljs">sudo dpkg -i ./containerd.io_* \
./docker-ce_* \
./docker-ce-cli_* \
./docker-buildx-plugin_* \
./docker-compose-plugin_* </code></pre>
<p>6、启动服务并设置开机启动</p>
<pre class=""><code class="language-bash hljs">sudo systemctl start docker
sudo systemctl enable docker</code></pre>
<p> </p>
<p>7、设置当前用户不需要sudo 使用docker命令</p>
<pre class=""><code class="language-bash hljs">#将登录用户加入docker组
sudo usermod -aG docker $USER
#更新用户组
sudo newgrp docker</code></pre>
<p> </p>
<p>8、退出当前用户,重新登录,重新连接一次终端也可以</p>
<pre class=""><code class="language-bash hljs">docker run hello-world //这个可能有代理问题,如果是阿里云的服务器可以配置阿里云的代理,如果不是用下面的临时替代测试是否成功
docker run m.daocloud.io/docker.io/library/hello-world 测试是否安装成功</code></pre>
<p> </p>
<p>9、配置镜像</p>
<pre class=""><code class="language-bash hljs">sudo vim /etc/docker/daemon.json
:set paste</code></pre>
<p> </p>
<p>在文件内输入</p>
<pre class=""><code class="language-json hljs">{
"registry-mirrors": [
"https://mirrors.tuna.tsinghua.edu.cn",
"https://mirrors.sohu.com",
"https://ustc-edu-cn.mirror.aliyuncs.com",
"https://ccr.ccs.tencentyun.com",
"https://docker.m.daocloud.io",
"https://docker.awsl9527.cn",
"https://mirror.ccs.tencentyun.com",
"https://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
]
}</code></pre>
<p> </p>
<p>10、重新加载并重启docker</p>
<pre class=""><code class="language-bash hljs">sudo systemctl daemon-reload
sudo systemctl restart docker</code></pre>
<p><br /><br /></p> |
1 |
37 |
1 |
1/7/26, 7:50 AM |
8/5/26, 8:58 AM |
View Edit Delete |
| 14 |
docker镜像操作 |
<p>查看本地的镜像</p>
<pre class=""><code class="hljs language-undefined">docker images</code></pre>
<p> </p>
<p>删除镜像</p>
<pre class=""><code class="hljs language-bash">docker rmi nginx:1.20.2
# 或者
docker rmi 74cc54e27dc4</code></pre>
<p> </p>
<p>自己构建镜像</p>
<pre class=""><code class="hljs language-bash"># -t 是给镜像起名,格式也是名字:版本,不指定版本默认为latest
# . 是指定Dockerfile所在目录,如果在当前目录,则指定为.
docker build -t myImage:1.0 .
</code></pre>
<p> </p>
<p>打包镜像</p>
<pre class=""><code class="hljs language-bash"># 在当前路径下保存一个文件名为nginx-1.20.2.tar的文件,里面包含nginx:1.20.2的镜像
docker -o nginx-1.20.2.tar nginx:1.20.2 </code></pre>
<p> </p>
<p>加载打包的镜像</p>
<pre class=""><code class="hljs language-css">docker load -i nginx-1.20.2.tar</code></pre> |
1 |
37 |
1 |
1/12/26, 2:22 PM |
1/12/26, 2:22 PM |
View Edit Delete |
| 15 |
docker容器操作 |
<p>查看正在运行的容器</p>
<pre class=""><code class="hljs language-undefined">docker ps</code></pre>
<p> </p>
<p>启动容器</p>
<pre class=""><code class="hljs language-bash"># 启动名为nginx的容器
docker start nginx</code></pre>
<p> </p>
<p>停止容器</p>
<pre class=""><code class="language-bash hljs"># 停止名为nginx的容器
docker stop nginx</code></pre>
<p> </p>
<p>删除容器</p>
<pre class=""><code class="hljs language-bash"># 前提必须stop容器
docker rm ngxin
#或者-f强制删除
或者 docker rm -f ngxin(IMAGE ID和IMAGE NAME都可以)</code></pre>
<p> </p>
<p>查看日志</p>
<pre class=""><code class="language-bash hljs">docker logs</code></pre>
<p> </p>
<p>进入某个容器内部</p>
<pre class=""><code class="language-bash hljs"># 进入nginx这个容器内部
docker exec -it nginx bash</code></pre>
<p> </p>
<p>从容器内部回到宿主机</p>
<pre class=""><code class="hljs language-bash">exit</code></pre>
<p> </p>
<p> </p> |
1 |
37 |
1 |
1/12/26, 2:26 PM |
1/22/26, 10:43 AM |
View Edit Delete |
| 16 |
docker数据卷操作 |
<p>创建数据卷</p>
<pre class=""><code class="hljs language-lua">docker volume create </code></pre>
<p> </p>
<p>查看所有数据卷</p>
<pre class=""><code class="hljs language-bash">docker volume ls</code></pre>
<p> </p>
<p>删除指定数据卷</p>
<pre class=""><code class="hljs language-bash">docker volume rm</code></pre>
<p> </p>
<p>查看某个数据卷的详情</p>
<pre class=""><code class="language-bash hljs">docker volume inspect
docker volume inspect nginx</code></pre>
<p> </p>
<p>清除所有未使用的数据卷</p>
<pre class=""><code class="hljs language-undefined">docker volume prune</code></pre> |
1 |
37 |
1 |
1/12/26, 2:28 PM |
1/12/26, 2:28 PM |
View Edit Delete |
| 17 |
docker 网络操作 |
<p>创建一个网络</p>
<pre class=""><code class="language-bash hljs">docker network create
docker network create timeless
</code></pre>
<p> </p>
<p>查看所有网络</p>
<pre class=""><code class="language-bash hljs">docker network ls</code></pre>
<p> </p>
<p>删除一个网络</p>
<pre class=""><code class="hljs language-bash">docker network rm</code></pre>
<p> </p>
<p>清除所有未使用的网络</p>
<pre class=""><code class="hljs language-undefined">docker network prune</code></pre>
<p> </p>
<p>使指定容器连接加入某网络</p>
<pre class=""><code class="language-perl hljs"># 同一网络内的容器 可以用容器名互相访问
docker network connect
docker network connect timeless mysql</code></pre>
<p> </p>
<p> </p>
<p>使指定容器连接离开某网络</p>
<pre class=""><code class="hljs language-sql">docker network disconnect</code></pre>
<p> </p>
<p>查看网络详情</p>
<pre class=""><code class="hljs language-undefined">docker network inspect</code></pre> |
1 |
37 |
1 |
1/12/26, 2:31 PM |
1/22/26, 10:43 AM |
View Edit Delete |
| 18 |
Dockerfile 操作 |
<p>FROM 指定基础镜像</p>
<pre class=""><code class="hljs language-css">From centos:7</code></pre>
<p> </p>
<p>ENV 设置环境变量</p>
<pre class=""><code class="hljs language-vbnet">ENV key=value</code></pre>
<p> </p>
<p>COPY 拷贝本地文件到镜像的指定目录</p>
<pre class=""><code class="hljs language-bash">COPY ./jdk17.tar.gz /tmp</code></pre>
<p> </p>
<p>RUN 执行linux的shell命令,一般是安装过程的命令 </p>
<pre class=""><code class="hljs language-bash">RUN tar -zxvf /tmp/jdk17.tar.gz</code></pre>
<p> </p>
<p>EXPOSE 指定容器运行时监听的端口,是给镜像使用者看的</p>
<pre class=""><code class="hljs language-yaml">ESPOSE 8080</code></pre>
<p> </p>
<p>ENTRYPOINT 镜像中应用的启动命令,容器运用时调用</p>
<pre class=""><code class="hljs language-undefined">ENTRYPOINT java -jar xx.jar</code></pre>
<p> </p> |
1 |
37 |
1 |
1/13/26, 12:34 AM |
1/22/26, 10:42 AM |
View Edit Delete |
| 19 |
docker compose 操作 |
<p>docker compose [Options] [command]</p>
<p>Options:</p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>-f<span style="white-space: pre;"> </span>指定compse文件的路径和名称</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>-p 指定project名称</span></p>
<p> </p>
<p>Commands:</p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>up<span style="white-space: pre;"> </span>创建并启动所有service容器</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>down 停止并移除所有容器、网络</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>ps 列出所有启动的容器</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>logs 查看指定的容器日志</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>stop 停止容器</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>start 启动容器</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>restart 重启容器</span></p>
<p><span style="white-space: normal;"><span style="white-space: pre;"> </span>top 查看运行的进程</span></p> |
1 |
37 |
1 |
1/13/26, 12:35 AM |
1/13/26, 12:35 AM |
View Edit Delete |
| 93 |
Ubuntu24.04利用Docker部署Seata2.6 |
<p>1、假设所有容器都在Docker下。</p>
<p>2、Seata的目录在Docker/Seata路径下。</p>
<p>3、创建目录结构</p>
<pre class=""><code class="hljs language-bash">mkdir -p /Docker/Seata/{seata-server,seata-namingserver,jars}
cd /Docker/Seata</code></pre>
<p> </p>
<p>4、从镜像提取 resources 和 libs</p>
<pre class=""><code class="hljs language-bash">docker create --name seata-tmp apache/seata-server:2.6.0
docker cp seata-tmp:/seata-server/resources seata-server/
docker cp seata-tmp:/seata-server/libs seata-server/
docker rm seata-tmp</code></pre>
<pre class=""><code class="hljs language-bash">docker create --name ns-tmp apache/seata-naming-server:2.6.0.jdk25
docker cp ns-tmp:/seata-naming-server/resources/application.yml seata-namingserver/
docker rm ns-tmp</code></pre>
<p> </p>
<p>5、修改 seata-server/resources/application.yml配置文件</p>
<pre class=""><code class="language-yaml hljs">#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
server:
port: 8091
spring:
application:
name: seata-server
main:
web-application-type: none
logging:
config: classpath:logback-spring.xml
file:
path: ${log.home:${user.home}/logs/seata}
extend:
logstash-appender:
# off by default
enabled: false
destination: 127.0.0.1:4560
kafka-appender:
# off by default
enabled: false
bootstrap-servers: 127.0.0.1:9092
topic: logback_to_logstash
producer:
acks: 0
linger-ms: 1000
max-block-ms: 0
metric-appender:
# off by default
enabled: false
seata:
config:
# support: nacos, consul, apollo, zk, etcd3
type: file
registry:
# support: nacos, eureka, redis, zk, consul, etcd3, sofa, seata
type: seata,nacos # ★ 默认是 file,改成双注册(与原生版一致)
seata:
server-addr: seata-namingserver:8081 # ★ 原生版是 192.168.20.140:8081
cluster: default # 两个容器都在 timeless 网络里,
namespace: public # 用容器名互访(Docker DNS 解析)
heartbeat-period: 5000
username: seata
password: seata
nacos:
application: seata-server
server-addr: nacos:8848 # ★ 原生版是 192.168.20.140:8848
group: SEATA_GROUP # nacos 容器在 timeless 网络里,
namespace: "" # container_name 是 nacos,直接用
cluster: default
username: nacos # 改成 Nacos 控制台的实际登录账号密码
password: nacos
store:
# support: file 、 db 、 redis 、 raft
mode: db
db:
datasource: druid
db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.20.140:3306/seata?useSSL=true&serverTimezone=Asia/Shanghai
user: seata
password: seata
min-conn: 5
max-conn: 30
global-table: global_table
branch-table: branch_table
lock-table: lock_table
distributed-lock-table: distributed_lock
query-limit: 100
max-retry-size: 10
server:
service-port: 8091 #If not configured, the default is '${server.port} + 1000'
</code></pre>
<p> </p>
<p>6、修改 seata-namingserver/application.yml配置文件</p>
<pre class=""><code class="hljs language-yaml">#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
server:
port: 8081
spring:
threads:
virtual:
enabled: true
mvc:
pathmatch:
matching-strategy: ant_path_matcher
ai:
mcp:
server:
protocol: streamable
streamable-http:
mcp-endpoint: /mcp
name: mcp-server
version: 1.0.0
application:
name: seata-namingserver
logging:
config: classpath:logback-spring.xml
file:
path: ${log.home:${user.home}/logs/seata}
heartbeat:
threshold: 90000
period: 60000
console:
# console username and password configuration
user:
username: seata # 主要就是改密码,线上环境不要用seata,seata
password: seata
# When the console is deployed independently, configure the namingserver address
# namingserver:
# protocol: http
# addr:
# - 127.0.0.1:8081
seata:
security:
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
tokenValidityInMilliseconds: 1800000
csrf-ignore-urls: /naming/v1/**,/api/v1/naming/**
ignore:
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/naming/v1/health,/error
# MCP Server Configuration
mcp:
# Maximum query time interval, The unit is milliseconds, Default one day
query:
max-query-duration: 86400000</code></pre>
<p> </p>
<p>7、改造 seata-server/libs</p>
<pre class=""><code class="hljs language-bash">cd /Docker/Seata/seata-server/libs
# ===== 改动 1:移出老 nacos-client(移到 jars/ 备份,别改名留在原地) =====
mv nacos-client-1.4.6.jar /Docker/Seata/jars/
# ===== 改动 2:放入 nacos-client 2.0.4 + 它的两个依赖 =====
# (Seata 2.6.0 自带的 1.4.6 只会调 Nacos v1 HTTP API,而 Nacos 3.x 彻底删除了 v1 API)
wget https://repo1.maven.org/maven2/com/alibaba/nacos/nacos-client/2.0.4/nacos-client-2.0.4.jar
wget https://repo1.maven.org/maven2/org/reflections/reflections/0.9.11/reflections-0.9.11.jar
wget https://repo1.maven.org/maven2/org/javassist/javassist/3.29.2-GA/javassist-3.29.2-GA.jar
# ===== 改动 3:放入 MySQL 驱动(放 libs 根目录!) =====
wget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.33/mysql-connector-j-8.0.33.jar
# ===== 确认 =====
ls -lh nacos-client* reflections* javassist* mysql-connector*
# nacos-client-2.0.4 约 14MB(gRPC+protobuf 打包在内,大是正常的)
# reflections 约 130KB,javassist 约 500KB,mysql-connector-j 约 2.4MB</code></pre>
<p> </p>
<p>8、修改docker-compose.yml文件</p>
<pre class=""><code class="hljs language-yaml">services:
seata-namingserver:
image: apache/seata-naming-server:2.6.0.jdk25
container_name: seata-namingserver
environment:
- TZ=Asia/Shanghai
ports:
- "8081:8081" # Web Console + MCP(/mcp)
volumes:
# 冒号左边是宿主机目录名(我们自己起的,与原生安装命名一致),
# 右边是镜像内置的容器内路径 /seata-naming-server/...(改不了,照抄)
- ./Seata/seata-namingserver/application.yml:/seata-naming-server/resources/application.yml
restart: always
networks:
- timeless
# ==================== seata-server(TC 主程序) ====================
seata-server:
image: apache/seata-server:2.6.0
container_name: seata-server
environment:
- SEATA_IP=192.168.20.140 # ★★ 最容易踩的坑,见下方说明
- SEATA_PORT=8091 # 遗留写法,2.x 实际不生效(端口由 yaml 的
# seata.server.service-port 决定),删掉也无影响
- STORE_MODE=db
- TZ=Asia/Shanghai
ports:
- "8091:8091" # TC 事务端口(TM/RM 客户端连这个)
volumes:
- ./Seata/seata-server/resources:/seata-server/resources # 配置(4.3 改好的)
- ./Seata/seata-server/libs:/seata-server/libs # 依赖(4.5 改好的)
depends_on: # ★ 只管同 compose 内的 namingserver
seata-namingserver:
condition: service_started # jib 镜像无健康检查,只等"启动"
restart: on-failure # ★★ 主力:Nacos 跨 compose 没法 depends_on,靠失败重试兜底
networks:
- timeless
networks:
timeless:
name: timeless
driver: bridge
</code></pre>
<p> </p>
<p>9、浏览器访问测试</p>
<pre class=""><code class="hljs language-perl">http://192.168.20.140:8081/#/transaction/list</code></pre> |
1 |
37 |
1 |
8/22/26, 7:40 PM |
8/22/26, 7:40 PM |
View Edit Delete |
| 94 |
Ubuntu24.04利用Docker部署Seata2.2 |
<p>1、假设所有容器都在Docker下。</p>
<p>2、Seata的目录在Docker/Seata路径下。</p>
<p>3、创建目录结构</p>
<pre class=""><code class="hljs language-bash">mkdir -p /Docker/Seata/{seata-server,jars}
cd /Docker/Seata</code></pre>
<p> </p>
<p>4、从镜像提取 resources 和 libs</p>
<pre class=""><code class="hljs language-bash"># ★ cp 目标写的是父目录 seata-server/(不是 seata-server/resources):
# docker cp 会把源目录整个拷到目标目录"里面"——目标若写成已存在的
# seata-server/resources,就会得到 seata-server/resources/resources,多套一层!
docker create --name seata-tmp apache/seata-server:2.2.0
docker cp seata-tmp:/seata-server/resources seata-server/
docker cp seata-tmp:/seata-server/libs seata-server/
docker rm seata-tmp</code></pre>
<p> </p>
<p>5、添加缺少的驱动</p>
<pre class=""><code class="hljs language-bash">cd /Docker/Seata/seata-server/libs
wget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.33/mysql-connector-j-8.0.33.jar</code></pre>
<p> </p>
<p>6、修改 seata-server/resources/application.yml</p>
<pre class=""><code class="language-yaml hljs">#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# 解决无限报错的BUG
"seata.store.db..vgroup-table": vgroup_table
server:
port: 7091
spring:
application:
name: seata-server
logging:
config: classpath:logback-spring.xml
file:
path: ${log.home:${user.home}/logs/seata}
extend:
logstash-appender:
destination: 127.0.0.1:4560
kafka-appender:
bootstrap-servers: 127.0.0.1:9092
topic: logback_to_logstash
console:
user:
username: seata
password: seata
seata:
config:
# support: nacos, consul, apollo, zk, etcd3
type: file
registry:
# support: nacos, eureka, redis, zk, consul, etcd3, sofa
type: nacos
nacos:
application: seata-server
server-addr: nacos:8848 # ★ 原生版是 192.168.20.139:8848
group: SEATA_GROUP # nacos 容器在同一 Docker 网络里,
namespace: "" # 用容器名互访(容器名不同就换掉 nacos)
cluster: default
username: nacos # ★ 改成你 Nacos 控制台的实际登录账号密码
password: nacos
store:
# support: file 、 db 、 redis 、 raft
mode: db
db:
datasource: druid
db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.20.139:3306/seata?useSSL=true&serverTimezone=Asia/Shanghai
# ★ 保持宿主机 IP!MySQL 在宿主机原生部署,
# 不在 Docker 网络里,不能用容器名
user: seata
password: seata
min-conn: 5
max-conn: 30
global-table: global_table
branch-table: branch_table
lock-table: lock_table
distributed-lock-table: distributed_lock
query-limit: 100
max-retry-size: 10
# server:
# service-port: 8091 #If not configured, the default is '${server.port} + 1000'
security:
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
tokenValidityInMilliseconds: 1800000
csrf-ignore-urls: /metadata/v1/**
ignore:
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error,/vgroup/v1/**
</code></pre>
<p> </p>
<p>7、修改docker-compose.yml文件</p>
<pre class=""><code class="language-yaml hljs">services:
nacos:
image: nacos/nacos-server:v2.5.3
container_name: nacos
ports:
- "8848:8848"
- "9848:9848"
environment:
MODE: standalone
SPRING_DATASOURCE_PLATFORM: mysql
MYSQL_SERVICE_HOST: 192.168.20.139
MYSQL_SERVICE_PORT: 3306
MYSQL_SERVICE_DB_NAME: nacos
MYSQL_SERVICE_USER: nacos
MYSQL_SERVICE_PASSWORD: nacos
MYSQL_SERVICE_DB_PARAM: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&serverTimezone=Asia/Shanghai
NACOS_AUTH_ENABLE: "true"
NACOS_AUTH_TOKEN: "tSZiqFk+O6P1oUQffkWgdLHjEVNkTDLQcwDqDbB9bsE=" # ⚠️ 生产环境必须更换
NACOS_AUTH_IDENTITY_KEY: nacos # ⚠️ 生产环境更换 key
NACOS_AUTH_IDENTITY_VALUE: nacos # ⚠️ 生产环境更换 value
volumes:
- ./nacos-server2.5.3/data:/home/nacos/data
- ./nacos-server2.5.3/logs:/home/nacos/logs
restart: always
networks:
- timeless
minio:
image: minio/minio:latest
container_name: minio
restart: unless-stopped
ports:
- "9000:9000" # S3 API
- "9001:9001" # Web 控制台
environment:
MINIO_ROOT_USER: admin
MINIO_ROOT_PASSWORD: adminTimeless # 至少 8 位,务必修改
volumes:
- /MinIO/Data:/data
- /MinIO/Conf/certs:/root/.minio/certs # 可选:HTTPS 证书目录,不用可删
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
logging:
driver: json-file
options:
max-size: "50m"
max-file: "3"
networks:
- timeless
seata-server:
depends_on:
nacos:
condition: service_started
image: apache/seata-server:2.2.0
container_name: seata-server
environment:
- SEATA_IP=192.168.20.139 # ★★ 最容易踩的坑,见下方说明
- SEATA_PORT=8091 # 遗留写法,2.x 实际不生效(端口由 yaml 的
# seata.server.service-port 决定),删掉也无影响
- STORE_MODE=db
- TZ=Asia/Shanghai
ports:
- "8091:8091" # TC 事务端口(TM/RM 客户端连这个)
- "7091:7091" # Web Console(2.2.0 内嵌,浏览器访问)
volumes:
- ./Seata/seata-server/resources:/seata-server/resources # 配置(4.4 改好的)
- ./Seata/seata-server/libs:/seata-server/libs # 依赖(4.3 加好驱动的)
restart: on-failure # ★★ Nacos 跨 compose 没法 depends_on,靠失败重试兜底
networks:
- timeless # ★ 换成 139 上 Nacos 的实际网络名
networks:
timeless:
name: timeless
driver: bridge
</code></pre>
<p> </p>
<p>8、浏览器验证</p>
<pre class=""><code class="hljs language-perl">http://192.168.20.139:7091/#/transaction/list</code></pre> |
1 |
37 |
1 |
8/22/26, 9:45 PM |
8/22/26, 9:45 PM |
View Edit Delete |
| 96 |
Docker安装Neo4j |
<p>1、创建目录/docker/neo4j</p>
<pre class=""><code class="language-bash hljs">mkdir -p /docker/neo4j
cd /docker</code></pre>
<p> </p>
<p>2、编辑或者创建docker-compose.yml文件</p>
<pre class=""><code class="language-yaml hljs">services:
neo4j:
image: neo4j:2026.07.1
container_name: neo4j
restart: unless-stopped
stop_grace_period: 60s
ports:
- "7474:7474" # HTTP / Neo4j Browser(网页管理界面)
- "7687:7687" # Bolt(驱动/代码连接)
# - "7473:7473" # HTTPS(需要 SSL 时取消注释)
# - "6362:6362" # 备份端口(仅企业版)
environment:
# ==================== 认证 ====================
# 格式:neo4j/密码。仅首次启动初始化数据目录时生效,之后改密码用:
# ALTER CURRENT USER SET PASSWORD FROM '旧密码' TO '新密码';
- NEO4J_AUTH=neo4j/neo4jadmin
# 密码最小长度(默认 8,不建议改小)
# - NEO4J_dbms_security_auth__minimum__password__length=8
# ==================== 网络 ====================
# 监听地址:0.0.0.0 允许远程访问;只本机用就改成 127.0.0.1
- NEO4J_server_default__listen__address=0.0.0.0
# 对外通告地址:浏览器/Bolt 连接串里显示用的地址。
# 有域名或固定公网 IP 时填上,比如 neo4j.example.com
# - NEO4J_server_default__advertised__address=你的域名或IP
# ==================== 内存(默认不限制,自动分配) ====================
# 服务器内存紧张时取消注释,按实际情况调数值
# - NEO4J_server_memory_heap_initial__size=512M # JVM 初始堆
# - NEO4J_server_memory_heap_max__size=1G # JVM 最大堆(建议不超过物理内存 1/3)
# - NEO4J_server_memory_pagecache_size=512M # 页缓存(图数据缓存,越大查询越快)
# ==================== 插件 ====================
# Docker 官方方式:启动时自动下载安装插件
# 可选:apoc / graph-data-science / bloom / genai / n10s
# 注意:首次启动联网下载,国内服务器可能慢
# - NEO4J_PLUGINS=["apoc"]
# - NEO4J_PLUGINS=["apoc", "graph-data-science"]
# 装了 APOC 后需要放开过程白名单,否则很多 apoc.* 调用会被拒
# - NEO4J_dbms_security_procedures_unrestricted=apoc.*
# - NEO4J_dbms_security_procedures_allowlist=apoc.*,gds.*
# ==================== JVM 附加参数 ====================
# 需要传额外 JVM 参数时用,一行一个(多个参数要拆成多条 server.jvm.additional)
# - NEO4J_server_jvm_additional=-XX:+UseG1GC
# - NEO4J_server_jvm_additional=-Dfile.encoding=UTF-8
# ==================== 数据库 ====================
# 默认数据库名(默认 neo4j,只能首次初始化时指定)
# - NEO4J_initial_dbms_default__database=neo4j
# 社区版只能同时运行 1 个用户库;企业版可建多库
# ==================== 监控 ====================
# Prometheus 指标导出,有监控体系(如 Grafana)再开
# - NEO4J_server_metrics_prometheus_enabled=true
# - NEO4J_server_metrics_prometheus_endpoint=0.0.0.0:2004
# 并放开端口:- "2004:2004"
# ==================== 日志 ====================
# 日志级别:DEBUG / INFO / WARN / ERROR
# - NEO4J_server_logs_debug_level=INFO
# 查询日志(记录慢查询,排查性能问题时开)
# - NEO4J_db_logs_query_enabled=INFO
# - NEO4J_db_logs_query_time__threshold=1s
# ==================== 备份(仅企业版) ====================
# - NEO4J_server_backup_enabled=true
# - NEO4J_server_backup_listen__address=0.0.0.0:6362
volumes:
- ./neo4j/volumes/data:/data # 数据目录(最重要,删容器不丢数据)
- ./neo4j/volumes/logs:/logs # 日志
- ./neo4j/volumes/import:/import # LOAD CSV 从这里读文件
- ./neo4j/volumes/plugins:/plugins # 手动放插件 jar 时用(和 NEO4J_PLUGINS 二选一)
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:7474 || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
# Neo4j 官方建议提高文件句柄上限,避免数据量大后报 Too many open files
ulimits:
nofile:
soft: 40000
hard: 40000
networks:
- timeless
networks:
timeless:
name: timeless
driver: bridge
</code></pre>
<p> </p>
<p>3、通过ip访问</p>
<pre class=""><code class="hljs language-bash">http://192.168.20.143:7474/browser/
帐号:neo4j
密码:neo4jadmin</code></pre> |
1 |
37 |
1 |
9/8/26, 9:34 PM |
9/8/26, 9:34 PM |
View Edit Delete |
| 97 |
Docker安装gitlab |
<p>1、创建Docker目录</p>
<pre class=""><code class="hljs language-bash">sudo mkdir /Docker</code></pre>
<p> </p>
<p>2、创建docker-compose.yml文件</p>
<pre class=""><code class="language-bash hljs">services:
gitlab:
image: gitlab/gitlab-ce:latest # 上服务器时建议固定版本号,如 gitlab/gitlab-ce:17.11.0-ce.0
container_name: gitlab
restart: unless-stopped
hostname: gitlab.leon # 测试域名,宿主机 hosts 里加一条指向虚拟机 IP
shm_size: 256m
environment:
GITLAB_OMNIBUS_CONFIG: |
########################################################################
# 【访问地址】GitLab 对外暴露的完整 URL
# 决定页面上显示的 clone 地址、webhook 回调地址;http 还是 https 也由它决定
# 测试期用 http://gitlab.local(宿主机 hosts 绑定虚拟机 IP)
# 上服务器有域名后改成 'https://gitlab.你的域名.com'
########################################################################
external_url 'http://gitlab.leon'
########################################################################
# 【SSH 端口】容器内 gitlab-shell 走 22,但宿主机 22 被 docker 映射成 2222
# 此参数让页面上显示的 SSH clone 地址自动带上 2222 端口
# 效果:ssh://git@gitlab.local:2222/组名/仓库.git
########################################################################
gitlab_rails['gitlab_shell_ssh_port'] = 2222
########################################################################
# 【时区】影响界面时间显示和日志时间戳,统一成东八区
########################################################################
gitlab_rails['time_zone'] = 'Asia/Shanghai'
#=======================================================================
# 以下为【可选功能】,需要时取消注释即可(改完 docker compose up -d 生效)
#=======================================================================
#-----------------------------------------------------------------------
# 【内置监控栈】GitLab 自带的 Prometheus + Grafana + Alertmanager 等
# 监控对象是 GitLab 自身健康度(队列延迟、DB 连接、Sidekiq 堆积),不监控业务
# 默认关闭省约 1G 内存;想看 GitLab 运行指标时取消下行注释
#-----------------------------------------------------------------------
# prometheus_monitoring['enable'] = true
#-----------------------------------------------------------------------
# 【HTTPS 证书】external_url 写 https 时使用,自动向 Let's Encrypt 申请
# 前提:域名公网可达、80/443 端口开放。测试期不用开
#-----------------------------------------------------------------------
# letsencrypt['enable'] = true
# letsencrypt['contact_emails'] = ['你的邮箱@example.com']
#-----------------------------------------------------------------------
# 【HTTPS 手动证书】如果用自己买的证书(非 Let's Encrypt),放这里
# 上服务器后二选一:要么 letsencrypt 自动签,要么手动指定证书路径
#-----------------------------------------------------------------------
# nginx['ssl_certificate'] = '/etc/gitlab/ssl/gitlab.crt'
# nginx['ssl_certificate_key'] = '/etc/gitlab/ssl/gitlab.key'
#-----------------------------------------------------------------------
# 【邮件】GitLab 发通知邮件(找回密码、CI 结果、成员邀请)用的 SMTP
# 不配则这些邮件一律发不出去;用 QQ/163 邮箱开 SMTP 即可
#-----------------------------------------------------------------------
# gitlab_rails['smtp_enable'] = true
# gitlab_rails['smtp_address'] = 'smtp.qq.com'
# gitlab_rails['smtp_port'] = 465
# gitlab_rails['smtp_user_name'] = '你的邮箱@qq.com'
# gitlab_rails['smtp_password'] = 'SMTP授权码(不是邮箱密码)'
# gitlab_rails['smtp_domain'] = 'smtp.qq.com'
# gitlab_rails['smtp_authentication'] = 'login'
# gitlab_rails['smtp_enable_starttls_auto'] = false
# gitlab_rails['smtp_tls'] = true
# gitlab_rails['gitlab_email_from'] = '你的邮箱@qq.com'
# gitlab_rails['gitlab_email_display_name'] = 'GitLab'
#-----------------------------------------------------------------------
# 【备份】自动备份配置
# backup_keep_time:备份文件保留秒数,604800 = 7 天
# 备份目录:./gitlab/data/backups/(随 data 卷一起持久化)
# 手动触发备份命令:docker exec gitlab gitlab-backup create
# 恢复命令:docker exec gitlab gitlab-backup restore BACKUP=备份文件时间戳
#-----------------------------------------------------------------------
gitlab_rails['backup_keep_time'] = 604800
#-----------------------------------------------------------------------
# 【注册开关】是否允许任何人自行注册账号
# 测试期和上线后都建议关掉,账号由管理员在后台创建
#-----------------------------------------------------------------------
# gitlab_rails['gitlab_signup_enabled'] = false
#-----------------------------------------------------------------------
# 【HTTPS 强制跳转】external_url 是 https 时,http 进来的请求是否 301 到 https
#-----------------------------------------------------------------------
# nginx['redirect_http_to_https'] = true
#-----------------------------------------------------------------------
# 【性能调优】并发 worker 数,默认按内存自动计算
# 小内存机器(如 4G)可手动调低缓解内存压力;16G 不用动
#-----------------------------------------------------------------------
# puma['worker_processes'] = 2
# sidekiq['concurrency'] = 10
ports:
- "80:80"
- "443:443"
- "2222:22" # 刻意避开宿主机 22
volumes:
- ./gitlab/config:/etc/gitlab
- ./gitlab/logs:/var/log/gitlab
- ./gitlab/data:/var/opt/gitlab
networks:
- timeless
networks:
timeless:
name: timeless
driver: bridge
</code></pre>
<p> </p>
<p>4、获取密码(默认帐号root)</p>
<pre class=""><code class="hljs language-bash">docker exec gitlab cat /etc/gitlab/initial_root_password</code></pre>
<p> </p>
<p>5、本地网络配置hosts</p>
<pre class=""><code class="hljs language-undefined">将gitlab.leon 映射到安装gitlab的服务器ip
192.168.20.140 gitlab.leon</code></pre>
<p> </p>
<p>5、web浏览器访问</p>
<pre class=""><code class="hljs language-bash">http://gitlab.leon/</code></pre>
<p> </p> |
1 |
37 |
1 |
10/1/26, 1:36 AM |
10/4/26, 3:35 AM |
View Edit Delete |
| 98 |
Docker安装jenkins |
<p>1、创建Docker目录</p>
<pre class=""><code class="hljs language-bash">sudo mkdir /Docker</code></pre>
<p> </p>
<p>2、创建docker-compose.yml文件</p>
<pre class=""><code class="hljs language-yaml">services:
jenkins:
image: jenkins/jenkins:lts # 官方 LTS 长期支持版;上服务器建议固定版本号,如 jenkins/jenkins:2.492.3-lts
container_name: jenkins
restart: unless-stopped
environment:
#-----------------------------------------------------------------------
# 【时区】界面时间戳显示为东八区
#-----------------------------------------------------------------------
TZ: Asia/Shanghai
#-----------------------------------------------------------------------
# 【JVM 内存】Jenkins 本身是 Java 进程
# 默认用容器内存的 50%,最大堆 4G;机器内存紧张时可手动压低,如 -Xmx1g
# 前者是初始堆,后者是最大堆
#-----------------------------------------------------------------------
JAVA_OPTS: "-Duser.timezone=Asia/Shanghai"
# JAVA_OPTS: "-Xms512m -Xmx2g -Duser.timezone=Asia/Shanghai"
#-----------------------------------------------------------------------
# 【Jenkins 参数】Jenkins 自身运行参数
# --httpPort=8080 Web 端口(默认 8080,改了的话 ports 映射也要同步改)
# --prefix=/jenkins URL 前缀,想用 http://IP:8080/jenkins 访问时加(默认无前缀)
#-----------------------------------------------------------------------
# JENKINS_OPTS: "--httpPort=8080 --prefix=/jenkins"
ports:
- "9090:8080" # Jenkins Web 界面
- "50000:50000" # Jenkins agent 通信端口(分布式构建时 agent 反连 master 用,单机可映射但不常用)
volumes:
# Jenkins 全部数据:任务配置、构建历史、插件、凭据,都在这个目录
# 迁移服务器时把 ./jenkins/data 打包带走即可
- ./jenkins/data:/var/jenkins_home
#-----------------------------------------------------------------------
# 【Docker-in-Docker】构建任务里要执行 docker 命令(打镜像、跑容器)时开启
# 注意两点:
# 1. jenkins/jenkins 官方镜像内没有 docker CLI,需进容器装:
# docker exec -u root jenkins bash -c "curl -fsSL https://get.docker.com | sh"
# 2. 挂载宿主 docker.sock 意味着 Jenkins 拿到宿主机 root 级权限,仅内网/测试环境这么干
#-----------------------------------------------------------------------
# - /var/run/docker.sock:/var/run/docker.sock
networks:
- timeless
networks:
timeless:
name: timeless
driver: bridge
</code></pre>
<p> </p>
<p>3、如果执行报错,多半是权限问题。</p>
<pre class=""><code class="hljs language-bash">sudo chown -R 1000:1000 /Docker/jenkins/data</code></pre>
<p> </p>
<p>4、获取初始密码</p>
<pre class=""><code class="hljs language-bash">docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword</code></pre>
<p> </p>
<p>5、web浏览器访问</p>
<pre class=""><code class="hljs language-cpp">http://192.168.20.140:9090/</code></pre>
<p> </p>
<p>6、插件安装</p>
<pre class=""><code class="language-bash hljs"># Plugins(插件管理)
1、Maven Integration
2、Locale(中文)
3、Localization: Chinese (Simplified)
4、GitLab Plugin
#Tools(全局工具配置)
1、配 Maven/JDK,加一个自动安装的 Maven
#Credentials(凭据)
1、存密码/Token,存 GitLab 的访问凭据,配拉代码时用</code></pre> |
1 |
37 |
1 |
10/1/26, 1:50 AM |
10/2/26, 3:31 AM |
View Edit Delete |