yum install docker
docker search hbase
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
解决办法:sudo systemctl start docker
再运行docker search hbase
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/harisekhon/hbase Apache HBase, opens shell - pseudo-distrib... 86 [OK]
docker.io docker.io/dajobe/hbase HBase 2.1.2 in Docker 25
docker.io docker.io/nerdammer/hbase HBase pseudo-distributed (configured for l... 25 [OK]
docker.io docker.io/banno/hbase-standalone HBase master running in standalone mode on... 17 [OK]
docker.io docker.io/boostport/hbase-phoenix-all-in-one HBase with phoenix and the phoenix query s... 9 [OK]
docker.io docker.io/zenoss/hbase HBase image for Zenoss 5.0 9
docker.io docker.io/harisekhon/hbase-dev Apache HBase + dev tools, github repos, ps... 7 [OK]
docker.io docker.io/bde2020/hbase-standalone Standalone Apache HBase docker image. Suit... 5 [OK]
docker.io docker.io/bde2020/hbase-regionserver Regionserver Docker image for Apache HBase. 4 [OK]
docker.io docker.io/gradiant/hbase-base Hbase small footprint Image (Alpine based) 3 [OK]
docker.io docker.io/smizy/hbase Apache HBase docker image based on alpine 3 [OK]
docker.io docker.io/aaionap/hbase AAI Hbase 2
docker.io docker.io/bde2020/hbase-master Master docker image for Apache HBase. 2 [OK]
docker.io docker.io/f21global/hbase-phoenix-server HBase phoenix query server 1 [OK]
docker.io docker.io/imagenarium/hbase 1
docker.io docker.io/imagenarium/hbase-master 1
docker.io docker.io/imagenarium/hbase-regionserver 1
docker.io docker.io/newnius/hbase Setup a HBase cluster in a totally distrib... 1 [OK]
docker.io docker.io/pilchard/hbase Hbase 1.2.0 (CDH 5.11) with openjdk-1.8 1 [OK]
docker.io docker.io/cellos/hbase HBase on top of Alpine Linux 0
docker.io docker.io/iwan0/hbase-thrift-standalone hbase-thrift-standalone 0 [OK]
docker.io docker.io/pierrezemb/hbase-docker hbase in docker 0 [OK]
docker.io docker.io/pierrezemb/hbase-standalone Docker images to experiment with HBase 1.... 0 [OK]
docker.io docker.io/stellargraph/hbase-hadoop 0
docker.io docker.io/stellargraph/hbase-master
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/dajobe/hbase latest cfd7eefee902 15 months ago 492 MB
docker run -d -h myhbase -p 2181:2181 -p 8080:8080 -p 8085:8085 -p 9090:9090 -p 9095:9095
-p 16000:16000 -p 16010:16010 -p 16201:16201 -p 16301:16301 --name hbase2 docker.io/dajobe/hbase
简单解释:
还可能做一些更多的映射以及docker 数据卷与宿主机的映射关系,此处没有用到,需要的请自行搜索
docker run -d --name hbase001 -p 16010:16010 docker.io/dajobe/hbase与docker run -d --name hbase001 -P docker.io/dajobe/hbase的区别:
docker run -d -p 2181:2181 -p 8080:8080 -p 8085:8085 -p 9090:9090 -p 9095:9095 -p 16000:16000 -p 16010:16010 -p 16201:16201 -p 16301:16301 --name hbase2 docker.io/daj
obe/hbase
结果:
cdfb7e24c051bc69083d715be42ea32efe7d8584b4609e475707ac43e0b40206
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cdfb7e24c051 docker.io/dajobe/hbase "/opt/hbase-server" 6 seconds ago Up 5 seconds 0.0.0.0:2181->2181/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:8085->8085/tcp, 0.0.0.0:9090->9090/tcp, 0.0.0.0:9095->9095/tcp, 0.0.0.0:16000->16000/tcp, 0.0.0.0:16010->16010/tcp, 0.0.0.0:16201->16201/tcp, 0.0.0.0:16301->16301/tcp hbase2
http://ip:16010/master-status
效果:
有两种方式,attach和exec,我们选择exec:
docker exec -it hbase2 bash
ps -aux|grep hbase即可查到端口、pid和目录信息:
ifconfig查看:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:88:1e:cd:ff txqueuelen 0 (Ethernet)
RX packets 549 bytes 1092247 (1.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 465 bytes 43279 (42.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.1.230 netmask 255.255.255.0 broadcast 172.16.1.255
ether 00:16:3e:16:6a:ac txqueuelen 1000 (Ethernet)
RX packets 3900038 bytes 2205407507 (2.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2437734 bytes 1234635259 (1.1 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 254754 bytes 147500058 (140.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 254754 bytes 147500058 (140.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
可以看到多出了个docker0网卡
然后systemctl restart network重启了下网卡,发现ip:16010访问不了了。。。。
猜想是docker0网卡的原因,于是删掉它:
yum -y install bridge-utils
ifconfig docker0 down
brctl delbr docker0
然后再重启网卡,问题解决。
ifconfig查看:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.17.0.1 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
0
可以看到多出了个docker0网卡
然后systemctl restart network重启了下网卡,发现ip:16010访问不了了。。。。
猜想是docker0网卡的原因,于是删掉它:
1.yum -y install bridge-utils
2.
3.ifconfig docker0 down
4.
5.brctl delbr docker0
然后再重启网卡,问题解决。
默认使用的网络模式是桥接模式,宿主机与容器的网络通过docker0网卡来通信,在这种模式下默认用容器id作为hostname的,需要在宿主机中配置容器ip与id的映射关系:
192.17.0.1 3c38a154df21
以host网络模式启动命令:
docker run -d --net=host --name hbase2 docker.io/dajobe/hbase
这种模式的特点是容器和宿主机共享网络,达不到网络隔离的效果。