0x00 安装
参考官网
0x01 问题
1. container-selinux依赖的问题
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum install epel-release
sudo yum install container-selinux
2. docker create失败
路由表冲突
sudo route del -net 172.16.0.0 netmask 255.240.0.0
或者
sudo ip link add name docker0 type bridge
sudo ip addr add dev docker0 172.17.0.1/16
0x02 docker使用
- 下载jenkins Image
sudo docker pull jenkins/jenkins:lts
- 映射host目录到container
注意权限问题
sudo chown -R 1000:1000 /home/xxx/jenkins_home
sudo docker run -v /home/xxx/jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
- 进入container shell环境
sudo docker exec -it fc833ba63f98 /bin/bash
// root login
sudo docker exec -i -t -u root
进入shell环境后再/var/jenkins_home目录下安装,对应的映射到host目录,docker重启后安装的sdk不会丢失
- 安装gradle
wget https://services.gradle.org/distributions/gradle-4.10.2-all.zip
- 安装android
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
// 列出android安装列表
tools/bin/sdkmanager --list
// 按需安装
tools/bin/sdkmanager "platform-tools"
tools/bin/sdkmanager "build-tools;28.0.2"
tools/bin/sdkmanager "platforms;android-28"
- 配置jenkins环境变量
ANDROID_HOME
GRADLE_HOME
网友评论