代码之家  ›  专栏  ›  技术社区  ›  Alexis.Rolland user2915097

使用数据初始化Cloudera Hive Docker容器

  •  1
  • Alexis.Rolland user2915097  · 技术社区  · 7 年前

    我正在Docker容器中运行Cloudera套件,使用下面描述的图像: https://hub.docker.com/r/cloudera/quickstart/

    我有以下配置:

    Dockerfile文件

    FROM cloudera/quickstart:latest
    

    version: '3.1'
    services:
    
      db-hive:
        container_name: mobydq-test-db-hive
        image: mobydq-test-db-hive
        restart: always
        build:
          context: .
          dockerfile: ./db-hive/Dockerfile
        expose:
          - 10000
        networks:
          - default
        hostname: quickstart.cloudera
        privileged: true
        tty: true
        command: ["/usr/bin/docker-quickstart"]
    
    networks:
      default:
        external:
          name: mobydq-network
    

    当容器启动时,我希望它自动创建一个新的数据库、一个表并用数据填充它。最好的办法是什么?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Alexis.Rolland user2915097    7 年前

    /user/bin/docker-quickstart 变成一个新的shell脚本 entrypoint.sh . 然后我将Create table和Insert语句直接添加到 .

    示例如下: https://github.com/mobydq/mobydq/blob/master/test/db-hive/init/entrypoint.sh

    最后我运行命令 入口点.sh