提前先安装配置好 Ubuntu server 14.04.5 参考资料:Ubuntu 16.04 Server 版安装过程图文详解
# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安装Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
# 安装指定版本的Docker-CE:
# Step 1: 查找Docker-CE的版本:
# apt-cache madison docker-ce
# docker-ce | 17.03.1~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
# docker-ce | 17.03.0~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
# Step 2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.1~ce-0~ubuntu-xenial)
# sudo apt-get -y install docker-ce=[VERSION]
root@ubuntu:/home/mgtv# docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:58 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:24 2018
OS/Arch: linux/amd64
Experimental: false
加速器的地址,您登录容器镜像服务控制台后左侧的加速器帮助页面就会显示为您独立分配的加速地址。
例如:
公网Mirror:[系统分配前缀].mirror.aliyuncs.com
Ubuntu的配置文件的位置在/etc/default/docker
下。您只需要在这个配置文件中添加加速器的配置项,重启Docker就可以了。
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=<your accelerate address>\"" | sudo tee -a /etc/default/docker
sudo service docker restart
Ubuntu 15.04之后的加速器配置方式有了一些变化。Ubuntu的配置文件的位置在/etc/systemd/system/docker.service.d/
目录下。在这个目录下创建任意的*.conf
文件就可以作为配置文件。然后在这个配置文件中添加加速器的配置项,重启Docker就可以了。
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/mirror.conf <<-'EOF'
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --registry-mirror=<your accelerate address>
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo docker pull openstf/stf:latest # STF镜像
sudo docker pull sorccu/adb:latest # android adb 镜像
sudo docker pull rethinkdb:latest # rethinkdb 镜像
sudo docker pull openstf/ambassador:latest
sudo docker pull nginx:latest # nginx 代理镜像
root@ubuntu:/home/mgtv# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
openstf/stf latest 1bd0199c8507 38 hours ago 775MB
nginx latest 62f816a209e6 6 days ago 109MB
rethinkdb latest 991f8de4f998 3 weeks ago 182MB
sorccu/adb latest 7123ee61b746 7 months ago 30.5MB
openstf/ambassador latest b1f0eb8297cf 3 years ago 6.46MB
docker run -d --restart=always --name rethinkdb -v /srv/rethinkdb:/data --net host rethinkdb rethinkdb --bind all --cache-size 8192 --http-port 8090
docker run -d --restart=always --name adbd --privileged -v /dev/bus/usb:/dev/bus/usb --net host sorccu/adb:latest
docker run -d --name stf --restart=always --net host openstf/stf stf local --public-ip 192.168.1.100
ldap方式启动
sudo docker run -d --name stf --restart=always --net host openstf/stf stf local --public-ip 172.31.36.77 --auth-type ldap --auth-options '["--ldap-url","ldap://10.27.116.158:389","--ldap-bind-dn","stf@mgtv.local","--ldap-search-dn","DC=mgtv,DC=local","--ldap-bind-credentials","dwEeeL2V","--ldap-search-class","user","--ldap-search-field","mail"]'
root@ubuntu:/home/mgtv# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d0816e3622f6 openstf/stf "stf local --public-…" 12 seconds ago Up 11 seconds stf
b0f9a341dcf1 sorccu/adb:latest "/sbin/tini -- adb -…" 10 minutes ago Up 10 minutes adbd
b5f23a29ddd3 rethinkdb "rethinkdb --bind al…" 10 minutes ago Up 10 minutes rethinkdb
查询服务器ip地址,然后在浏览器输入ip地址:7100
即可打开STF主页,登录即可使用。
mgtv@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d0816e3622f6 openstf/stf "stf local --public-…" 2 months ago Exited (1) About a minute ago stf
b0f9a341dcf1 sorccu/adb:latest "/sbin/tini -- adb -…" 2 months ago Up About a minute adbd
b5f23a29ddd3 rethinkdb "rethinkdb --bind al…" 2 months ago Up About a minute rethinkdb
sudo docker start 容器id
sudo docker start ca78f053002f b0f9a341dcf1 b5f23a29ddd3
3.查看容器log
sudo docker logs -f -t --since="2018-02-08" --tail=100 CONTAINER_ID
#查看某个事件段的log
sudo docker logs -t --since="2018-02-08T13:23:37" --until "2018-02-09T12:23:37" CONTAINER_ID
sudo docker run -d --name stf --restart=always --net host openstf/stf stf local --public-ip 172.31.36.77 --auth-type ldap --auth-options '["--ldap-url","ldap://10.26.13.147:389","--ldap-bind-dn","stf@mgtv.local","--ldap-search-dn","DC=mgtv,DC=local","--ldap-bind-credentials","dwEeeL2V","--ldap-search-class","user","--ldap-search-field","mail"]'
mgtv@ubuntu:~$ sudo pptpsetup --create vpn --server 175.6.15.75 --username shuqing --password 070337Shu --encrypt --start
Using interface ppp0
Connect: ppp0 <--> /dev/pts/1
CHAP authentication succeeded
MPPE 128-bit stateless compression enabled
添加路由
mgtv@ubuntu:~$ sudo route add -net 10.1.0.0/16 dev ppp0
sudo route add -net 10.100.0.0/16 dev ppp0
mgtv@ubuntu:~$ sudo route add -net 10.100.0.0/16 dev ppp0
mgtv@ubuntu:~$ sudo route add -net 10.200.0.0/16 dev ppp0
mgtv@ubuntu:~$ sudo route add -net 10.27.0.0/16 dev ppp0