In this lesson we will cover how to build your own custom Docker image from scratch. We'll walk through the process of starting a Debian container, installing packages and working through configuration issues, as well as a strategy for building a Dockerfile.

// Installl debian then swich to bash interactive mode
docker run -it debian bash // download tegine
curl http://tengine.taobao.org/download/tengine-2.2.0.tar.gz > /opt/tengine-2.2.0.tar.gz // If curl not found
apt-get update
apt-get install -y curl // cd to the download folder and unzip the file
cd /opt
tar xzf tengine-2.2..tar.gz // then you are able to see tegine-2.2.0 folder
cd tengine-2.2. // Check the document how to install tegine
apt-get install -y gcc
apt-get install -y libpcre3
apt-get install -y libssl-dev
./configure
pat-get install -y make
make
make install // After tegine was install, cd to the sbin folder and run nginx
cd /usr/local/nginx/sbin
/usr/local/nginx/sbin/nginx
ps aux // check whether nginx started or not

Then we exit from the cmd:

exit

mkdir tengine
cd tengine/
vim Dockerfile

Building the docker file:

FROM debian
RUN apt-get update && apt-get install -y \
curl \
gcc \
libpcre3-dev \
libssl-dev \
make RUN curl http://tengine.taobao.org/download/tengine-2.2.0.tar.gz > /opt/tengine-2.2.0.tar.gz WORKDIR /opt RUN tar xzf tengine-2.2..tar.gz WORKDIR /opt/tengine-2.2. RUN ./configure RUN make RUN make install // Then we need to start nginx: https://github.com/nginxinc/docker-nginx/blob/4d1f7f8ec281117d1d79bed4c6bc28b86039ca84/stable/stretch/Dockerfile
// Can find cmd on Docker nginx hub RUN ln -sf /dev/stdout /usr/local/nginx/logs/access.log \
&& ln -sf /dev/stderr /usr/local/nginx/logs/error.log EXPOSE CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]

Now we can build our image:

docker build -t zwan/tengine:2.2. .

Check images:

dcoker images

Run image:

docker run -p : zwan/tengine:2.2.

Then check localhost:8000.

最新文章

  1. CROSS APPLY应用实例
  2. spyder常用快捷键
  3. 某酒店2000W数据
  4. JMS - 消息确认
  5. hdoj 3018 Ant Trip(无向图欧拉路||一笔画+并查集)
  6. Win7安装IIS
  7. uva 1418 - WonderTeam
  8. springBoot(12)---整合Swagger2
  9. python基础一 ------如何获取多个字典相同的键
  10. pytest 3.9在python 2.7下的一个bug
  11. [朴智妍][Lullaby]
  12. numpy行转列
  13. Mysql 5.7.21 单机多实例安装
  14. MySQL无损复制(转)
  15. ubuntu 设置DNS
  16. AVL树原理及实现 +B树
  17. Java之集合(二十一)LinkedTransferQueue
  18. 整理sql server数据类型
  19. redis优化方案
  20. hdu 1879 继续畅通工程 (最小生成树)

热门文章

  1. 30.Node.js 全局对象
  2. map按value查找相应元素
  3. Spring学习总结(5)——IOC注入方式总结
  4. 用py2exe打包成一个exe文件
  5. bootstrap课程13 bootstrap的官方文档中有一些控件的使用有bug,如何解决这个问题
  6. 24. Spring Boot 事务的使用
  7. ASP.NET MVC案例教程(基于ASP.NET MVC beta)——第四篇:传递表单数据
  8. 【软件project】 文档 - 银行业务管理 - 需求分析
  9. Android 解决RecyclerView删除Item导致位置错乱的问题
  10. LeetCode Algorithm 07_Reverse Integer