一、bridge模式启动docker
1、安装docker
(1)yum remove docker
(2)yum remove docker-selinux
(3)vim /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
(4) yum install docker-engine
(5)vim /etc/docker/daemon.json 添加
{"storage-driver":"devicemapper"}
(6)vim /etc/sysconfig/docker
在docker里禁用selinux,–selinux-enabled=false,
(7)启动docker systemctl start docker
2、导入镜像
docker import cloudera-quickstart-vm-5.13.0-0-beta-docker.tar
docker tag imageID cloudera/quickstart:latest
3、启动
docker run --name cdh --hostname=quickstart.cloudera --privileged=true -t -i -p 8020:8020 -p 8022:8022 -p 7180:7180 -p 21050:21050 -p 50070:50070 -p 50075:50075 -p 50010:50010 -p 50020:50020 -p 8890:8890 -p 60010:60010 -p 10002:10002 -p 25010:25010 -p 25020:25020 -p 18088:18088 -p 8088:8088 -p 19888:19888 -p 7187:7187 -p 11000:11000 cloudera/quickstart /bin/bash -c '/usr/bin/docker-quickstart && /home/cloudera/cloudera-manager --express && service ntpd start'
注意:如果启动报错,进入docker单独启动:
/usr/bin/docker-quickstart
/home/cloudera/cloudera-manager --express && service ntpd start
进入docker的方法 docker attach cdh
在docker容器中
vim /etc/hadoop/conf.cloudera.hdfs/hdfs-site.xml