使用数据初始化Cloudera Hive Docker容器 [英] Initialize Cloudera Hive Docker Container With Data
问题描述
我正在使用此处描述的图像在Docker容器中运行Cloudera套件: https: //hub.docker.com/r/cloudera/quickstart/
I am running the Cloudera suite in a Docker Container using the image described here: https://hub.docker.com/r/cloudera/quickstart/
我具有以下配置:
Dockerfile
FROM cloudera/quickstart:latest
Docker Compose文件
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
当容器启动时,我希望它自动创建一个新数据库,一个表,并用数据填充它。最好的方法是什么?
When the container start, I would like it creates automatically a new database, a table and populates it with data. What would be the best way to do that?
推荐答案
我发现的解决方案是复制脚本的内容 / user / bin / docker-quickstart
放入新的Shell脚本 entrypoint.sh
。然后,我直接在 entrypoint.sh
中添加了Create表和Insert语句。
The solution I have found is to copy the content of the script /user/bin/docker-quickstart
into a new shell script entrypoint.sh
. Then I added the Create table and Insert statements directly in the entrypoint.sh
.
此处的示例: https://github.com/mobydq/mobydq/blob /master/test/db-hive/init/entrypoint.sh
最后,我运行命令 entrypoint.sh
而不是快速入门脚本。
Finally I run the command entrypoint.sh
in the docker compose file instead of the quickstart script.
这篇关于使用数据初始化Cloudera Hive Docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!