RUN A hiveserver2 in docker containr (please follow the link http://rajkrrsingh.blogspot.com/2019/07/running-hiveserver2-on-docker.html)
Get the container id or container name for a running container.
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0749ae15ece8 hive3-image "hive --service hive…" 20 hours ago Up 20 hours 0.0.0.0:10000->10000/tcp jovial_swartz
now you can use container id or the container name to connect with container interactively
mkdir hive-3-image
cd hive-3-image/
wget https://raw.githubusercontent.com/alanfgates/sqltest/master/dbs/hive/v3_1/Dockerfile
docker build . -t hive3-image
// Run it
docker run -it --net=myNetwork -p 10000:10000 hive3-image
You will see following logs on stdout if everything goes well
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/grid/hadoop-3.1.1/bin:/grid/apache-hive-3.1.1-bin/bin)
2019-07-24 22:22:18: Starting HiveServer2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/grid/apache-hive-3.1.1-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/grid/hadoop-3.1.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = 7ac431e6-9619-4cfc-a98d-00cb3cd6e9dc
Hive Session ID = cb5986e4-38dd-401c-aea6-d7f1032790ad
Hive Session ID = 525af947-9fc4-4445-a7c3-227ae861f513
Hive Session ID = ee73bf5e-4baa-420e-b409-55dabf67cf61
I know this is a very naive approach but lets stick to it, get the hostname of hiveserver2 docker container using (by default container id is default hostname)
docker ps -a | grep hive3-image
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0749ae15ece8 hive3-image "hive --service hive…" 2 minutes ago Up 2 minutes 0.0.0.0:10000->10000/tcp jovial_swartz
// get hostname
docker inspect 0749ae15ece8 | grep -i host
"HostnamePath": "/var/lib/docker/containers/0749ae15ece81ae9e429d19f28c9f0bed52f7837f6984f9619aab6618f97a5f4/hostname",
"HostsPath": "/var/lib/docker/containers/0749ae15ece81ae9e429d19f28c9f0bed52f7837f6984f9619aab6618f97a5f4/hosts",
"HostConfig": {
"HostIp": "",
"HostPort": "10000"
"ExtraHosts": null,
"Hostname": "0749ae15ece8",
"HostIp": "0.0.0.0",
"HostPort": "10000"
docker run -it --net=myNetwork beeline_docker
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/grid/apache-hive-3.1.1-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/grid/hadoop-3.1.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://0749ae15ece8:10000
Connected to: Apache Hive (version 3.1.1)
Driver: Hive JDBC (version 3.1.1)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.1 by Apache Hive
0: jdbc:hive2://0749ae15ece8:10000> show tables;
INFO : Compiling command(queryId=hive_20190724222711_18df4f09-d690-4774-af47-abe0c63bf8b2): show tables
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Semantic Analysis Completed (retrial = false)
INFO : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO : Completed compiling command(queryId=hive_20190724222711_18df4f09-d690-4774-af47-abe0c63bf8b2); Time taken: 1.391 seconds
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Executing command(queryId=hive_20190724222711_18df4f09-d690-4774-af47-abe0c63bf8b2): show tables
INFO : Starting task [Stage-0:DDL] in serial mode
INFO : Completed executing command(queryId=hive_20190724222711_18df4f09-d690-4774-af47-abe0c63bf8b2); Time taken: 0.063 seconds
INFO : OK
INFO : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name |
+-----------+
+-----------+
No rows selected (1.974 seconds)