若是你還想從頭學起 Docker,能夠看看這個系列的文章哦!html
https://www.cnblogs.com/poloyy/category/1870863.htmlnode
直接參考我這篇文章哦:http://www.javashuo.com/article/p-kyfekeqh-nu.htmlpython
docker search jenkins
重點講下前三個git
docker pull jenkins/jenkins
這樣就會下載最新版本的 jenkins 鏡像啦github
docker images
用於掛載目錄docker
mkdir -p /var/jenkins_node
可讀可寫可執行ubuntu
chmod -R 777 /var/jenkins_node
docker run -d -uroot -p 80:8080 --name jenkins1 -v /var/jenkins_node:/var/jenkins_home jenkins/jenkins
docker ps
docker exec -it -uroot jenkins1 bash
這裏也能夠指定 root 身份進入容器centos
# 獲取最新的軟件包 apt-get update # 升級已安裝的軟件包 apt-get upgrade # 提早安裝,以便接下來的配置操做 apt-get -y install gcc automake autoconf libtool make apt-get -y install make* apt-get -y install zlib* apt-get -y install openssl libssl-dev apt-get install sudo
cd /usr/local/src wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz tar -zxvf Python-3.6.8.tgz mv Python-3.6.8 py3.6 cd py3.6
在 /usr/local/src/py3.6 安裝目錄下執行下面的命令bash
./configure --prefix=/var/jenkins_home/py3.6 make && make install
ln -s /usr/local/src/py3.6/bin/python3.6 /usr/bin/python3
ln -s /usr/local/src/py3.6/bin/pip3 /usr/bin/pip3
自己有的話忽略就行ui
敲 python3 和 pip3 有下圖的結果就是正常了
須要在 python 項目生成一個 requirement.txt,具體教程能夠看
http://www.javashuo.com/article/p-ksuwvzcz-nu.html
pip3 install -r requirements.txt
https://github.com/allure-framework/allure2/releases
選個最新版本的去下就行,或者本身挑一個版本
docker cp allure-commandline-2.13.6.zip jenkins1:/usr/local/src
unzip allure-commandline-2.13.6.zip
mv allure-2.13.6 allure chmod -R 777 allure
cat >> /etc/profile << "EOF" export PATH=/usr/local/src/allure/bin:$PATH export PATH=/usr/local/src/py3.6/bin:$PATH EOF
記得一行一個回車哦,否則就直接複製粘貼
source /etc/profile
allure --version
python3 --version
export
這裏能夠看到不少容器自己自帶的環境變量
cat >> /etc/profile << "EOF" export PATH=$JAVA_HOME/bin:$PATH EOF
source /etc/profile