docker consul 导入导出配置文件

docker cp /opt/mvp/base/consul_kv.json f801a403:consul_kv.json
docker exec f801a403 consul kv import --http-addr=http://127.0.0.1:8500 @consul_kv.json





docker exec d488dca306a5 /bin/sh -c "consul kv export --http-addr=http://127.0.0.1:8500  > consul_kv.json"
docker cp d488dca306a5:consul_kv.json /opt/mvp/base/consul_kv.json

 

 

 

CONSUL_CONTAINER_ID=`docker ps | grep consul | awk '{print $1}'`

docker exec $CONSUL_CONTAINER_ID /bin/sh -c "consul kv export --http-addr=http://127.0.0.1:8500  > consul_kv.json"
docker cp $CONSUL_CONTAINER_ID:consul_kv.json /opt/mvp/base/consul_kv.json 

docker cp /opt/mvp/base/consul_kv.json $CONSUL_CONTAINER_ID:consul_kv.json
docker exec $CONSUL_CONTAINER_ID consul kv import --http-addr=http://127.0.0.1:8500 @consul_kv.json

 

 

/opt/consul/bin/consul kv export --http-addr=http://127.0.0.1:38500  > consul_kv.json

posted @ 2023-12-13 10:55  tonggc1668  阅读(157)  评论(0编辑  收藏  举报