初次使用dockerfile创建自定义镜像-阿里云开发者社区

开发者社区> 开发与运维> 正文

初次使用dockerfile创建自定义镜像

简介: dockerfile实现自定义镜像,简单易上手

FROM centos:7.6.1810

维护人信息

MAINTAINER The Ecs Automation Project 13152027756@163.com
ENV PATH $PATH:/usr/local/python3/bin/
ENV PYTHONIOENCODING utf-8
RUN set -ex
&& mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
&& curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
&& yum makecache
&& sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
&& yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make wget
&& yum clean all
&& mkdir /usr/local/python3
&& wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
&& tar -xvJf Python-3.6.8.tar.xz && rm -f Python-3.6.8.tar.xz
&& cd Python-3.6.8
&& ./configure prefix=/usr/local/python3
&& make && make install
&& cd ..
&& pip3 --default-timeout=1000 install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
&& pip3 --default-timeout=1000 install --upgrade setuptools -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
&& pip3 --default-timeout=1000 install robotframework-selenium2library -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
&& pip3 --default-timeout=1000 install robotframework -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
&& pip3 --default-timeout=1000 install robotframework-ride==1.5.2.1 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
&& && pip3 --default-timeout=1000 install pyvirtualdisplay -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
&& pip3 --default-timeout=1000 install robotframework-pabot -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
&& cd /etc/yum.repos.d/
&& yum -y install firefox
&& firefox --version
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
&& tar -zxf geckodriver-v0.24.0-linux64.tar.gz
&& mv geckodriver /usr/local/bin
&& firefox --version
&& cd /etc/
&& echo "106.11.210.201 g.alicdn.com" >> hosts
&& echo "100.67.79.188 ecs-buy.aliyun.com" >> hosts
&& echo "100.67.79.188 eci.console.aliyun.com" >> hosts
&& echo "100.67.79.188 ecs.console.aliyun.com" >> hosts

安装httpd软件包

RUN yum -y update
&& yum -y install httpd
&& yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make wget
&& wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
&& chmod +x jdk-8u131-linux-x64.rpm
&& rpm -ivh jdk-8u131-linux-x64.rpm
CMD ["usr","bin","bash"]

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章