Deploy Seata Server By Docker
Quick Start
Start a seata-server instance
$ docker run --name seata-server -p 8091:8091 apache/seata-server:2.1.0
Specify server IP and port
$ docker run --name seata-server \
-p 8091:8091 \
-e SEATA_IP=192.168.1.1 \
-e SEATA_PORT=8091 \
apache/seata-server
Docker compose
Example of docker-compose.yaml
version: "3"
services:
seata-server:
image: apache/seata-server
hostname: seata-server
ports:
- "8091:8091"
environment:
- SEATA_PORT=8091
- STORE_MODE=file
Access container and view log
$ docker exec -it seata-server sh
$ docker logs -f seata-server
Using custom configuration file
Custom configuration implement by mount registry.conf
and file.conf
to container.
- Specify registry.conf
The environment variableSEATA_CONFIG_NAME
is required when use a custom configuration , and the value must be started with file:
like file:/root/seata-config/registry
:
$ docker run --name seata-server \
-p 8091:8091 \
-e SEATA_CONFIG_NAME=file:/root/seata-config/registry \
-v /User/seata/config:/root/seata-config \
apache/seata-server
The param -e
specify environment, and the param -v
specify mount volume.
- Specify file.conf
If you need specify file.conf
, just modify config
like below in registry.conf
file:
config {
type = "file"
file {
name = "file:/root/seata-config/file.conf"
}
}
Environment Variables
You can modify configuration of seata-server by the environment variables like this:
- SEATA_IP
The variable is optional, specifies registry IP instead of the container IP in registry center like eureka or others.
- SEATA_PORT
The variable is optional, specifies seata-server port, default is
8091
- STORE_MODE
The variable is optional, specifies the log store mode of seata-server, support
db
andfile
, default isfile
.
- SERVER_NODE
The variable is optional, specifies the seata-server node ID, like
1
,2
,3
..., default is1
- SEATA_ENV
The variable is optional, specifies the seata-server environment, like
dev
,test
etc. Then server will find file likeregistry-dev.conf
under the configuration path when start.
- SEATA_CONFIG_NAME
The variable is optional, specifies the configuration file path, like the
file:/root/registry
, will load file/root/registry.conf
as configuration. If need specifyfile.conf
configuration,theconfig.file.name
value inregistry.conf
file need to change as related config, likefile:/root/file.conf