windows下docker compose方式挂载数据卷volume遇到的问题

例子一,windows 下docker desk top部署TDengine
td-compose.yml

version: '3'
services:
  tdengine1:
    image: tdengine/tdengine:latest
    container_name: tdengine1
    hostname: tdengine1
    ports:
        - 6030:6030
        - 6041:6041
        - 6043-6049:6043-6049
        - 6043-6049:6043-6049/udp
    restart: always
    environment:
      TAOS_FQDN: "tdengine1"
      TAOS_FIRST_EP: "tdengine1"
    volumes:
      - D:\tdenginedata\taos.cfg:/etc/taos/taos.cfg
      - D:\tdenginedata\data:/var/lib/taos/
      - D:\tdenginedata\log:/var/log/taos/
      - D:\tdenginedata\corefile:/corefile

运行docker-compose

docker compose -p tdengine -f td-compose.yml up -d

问题1:
配置文件映射卷,但没有自己生成配置文件反而报错。
解决方案:bind mount直接挂载目录的方式必须将配置文件先复制下来宿主机,因为它是按宿主机文件同步。

问题2:
部署后出现UDF一直提示重启restart:

2023-08-28 08:45:55 08/28 00:45:55.404059 00000118 UDF start to init udfd
2023-08-28 08:45:55 08/28 00:45:55.404068 00000118 UDF udfd LD_LIBRARY_PATH: ::/usr/lib
2023-08-28 08:45:55 08/28 00:45:55.595022 00000118 UDF udfd is initialized
2023-08-28 08:45:55 08/28 00:45:55.626228 00000118 UDF udfd process exited with status 251, signal 0
2023-08-28 08:45:55 08/28 00:45:55.626269 00000118 UDF udfd process restart

解决方案:经官方查询是因为要在目录下创建特殊的socket,而windows目录不能创建这种特殊的目录。在taos.cfg配置文件任意位置添加一行udf 0,关闭UDF。如果实在要用udf要参见下面oceanbase部署volume方式。

例子二,windows 下docker desk top部署Oceanbase
以下是会出现问题的ob-compose.yml

version: '3'
services:
  oceanbase1:
    image: oceanbase/oceanbase-ce:latest
    container_name: oceanbase1
    hostname: oceanbase1
    ports:
        - 2881:2881
    restart: always
    privileged: true
    volumes:
      - //d/obdata/ob:/root/ob
      - //d/obdata/obd:/root/.obd

运行docker-compose

docker compose -p oceanbase -f ob-compose.yml up -d

运行后出错提示/root/ob/run/observer.pid: Operation not permitted:

[2023-08-29 00:18:28.103] [DEBUG] -- local execute: cat /root/ob/run/observer.pid 
[2023-08-29 00:18:28.117] [DEBUG] -- exited code 1, error output:
[2023-08-29 00:18:28.119] [DEBUG] cat: /root/ob/run/observer.pid: Operation not permitted

看样子应该和上面TDengine一样,有linux的特殊目录文件要创建,因此没办法用bind mount形式,只能改用volume的形式。
最终的ob-compose.yml如下:

version: '3'
services:
  oceanbase1:
    image: oceanbase/oceanbase-ce:latest
    container_name: oceanbase1
    hostname: oceanbase1
    ports:
        - 2881:2881
    restart: always
    privileged: true
    volumes:
      - ob:/root/ob
      - obd:/root/.obd
volumes:
      ob:
      obd:

你可能感兴趣的:(Docker,docker,tdengine,oceanbase)