1、系统环境:CentOS7html
centos全部版本下载地址:http://mirrors.aliyun.com/centos/linux
查看CentOS的版本号:cat /etc/centos-releaseweb
查询操做系统内核版本信息:uname -rdocker
查看操做系统位数:getconf LONG_BITshell
关闭防火墙:systemctl stop firewalld.service数据库
查看防火墙状态:systemctl status firewalld.servicewindows
Active行存在disavtive或dead的字样,说明防火墙已经关闭centos
2、CentOS7部署Docker浏览器
一、安装必要的系统工具app
yum install -y yum-utils device-mapper-persistent-data lvm2
二、添加软件源信息
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
三、更新并安装docker-ce
yum makecache fast
yum -y install docker-ce
四、设置开机时自动启动(可不设置开机自动启动)
systemctl enable docker
五、查看docker运行状态
systemctl status docker
六、查看已安装的docker-ce版本信息
七、查看docker全部运行的容器
八、 以上docker安装完成,接下来就是须要docker加速器配置了。至因而为何须要镜像加速呢?由于你在中国(你懂得)
在安装的时候我添加的是阿里的软件源,这里我也用阿里云的镜像加速。
首先,打开阿里云网站:https://cr.console.aliyun.com
其次,打开网页中 镜像中心--镜像加速器,默认会生成属于你我的的一个加速器地址
这里我将命令写在一个shell中,内容以下(由于我知道docker安装的时候默认安装在/etc/docker下,因此我就再也不递归建立)
将shell脚本加上可执行权限,执行如下便可完成了镜像加速的配置并从新加载的配置文件和重启了docker。
至此,Docker的安装搞定。
问题:
一、docker报错Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid
解决办法:同步一下时间:ntpdate cn.pool.ntp.org
3、使用Docker部署STF安卓设备管理平台
第一步拉取镜像
一、拉取STF镜像:docker pull openstf/stf:latest
二、拉取adb镜像:docker pull sorccu/adb:latest
三、拉取rethinkdb镜像:docker pull rethinkdb:latest
四、查看拉取下来的镜像:docker images
第二步启动镜像
一、启动rethinkdb数据库
docker run -d --name rethinkdb -v /srv/rethinkdb:/data --net host rethinkdb rethinkdb --bind all --cache-size 500 --http-port 8090
二、启动adb服务
docker run -d --name adbd --privileged -v /dev/bus/usb:/dev/bus/usb --net host sorccu/adb:latest
三、启动STF安卓设备管理平台
本地启动:docker run -d --name stf --net host openstf/stf stf local --allow-remote
可远程访问:docker run -d --name stf --net host openstf/stf stf local --allow-remote --public-ip 10.117.34.33
四、经过浏览器访问web页面,默认端口是7100。登陆的用户名和邮箱符合格式要求便可,尽情玩耍吧,少年。
这里我没有链接安卓设备全部显示为0,没有设备链接。
4、Docker部署的adb链接设备
如何使用docker拉取的adb 链接设备呢?
首先,要知道怎么像系统adb命令同样使用adb命令。
其次,接入安卓设备进STF平台中,实现安卓设备的统一管理。
来吧,展现:
adb链接设备的两种方式:
一、USB直连模式
二、adb WiFi模式
以上两种模式都可参考我以前的文章:https://www.cnblogs.com/hanxiaobei/p/12941996.html
5、另外一种接入设备的方式(该方式为adb链接设备两种方式中的USB直连)
由于我搭建STF是在CentOS虚拟机中,我本地windows宿主机有adb且链接了手机,我想启动STF时直接挂上宿主机的设备。Just Do It!
前提:
一、宿主机和虚拟机在同一网段且和联通(ping命令了解一下)
二、宿主机启动adb
问题:
使用命令:adb -a -P 5037 fork-server server启动时报:reply fd for adb server to client communication not specified. 这时能够用上图中的命令从新启动一下。
链接上以后用adb观察一下设备列表展现:
三、从新启动一下Docker中的STF
从新启动的命令:docker run -d --name stf --privileged=true --net host openstf/stf stf local --public-ip 192.168.209.130 --adb-host 192.168.209.1 --adb-port 5037 --allow-remote
192.168.209.130 为我虚拟机CentOS7的IP
192.168.209.1 为我宿主机Windows10的IP
其余命令参考上图中露出