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.

[Docker] Build Your Own Custom Docker Image的更多相关文章

  1. 【云计算】docker build如何支持参数化构建?

    docker 1.9.0版本之后,已经支持docker build参数化构建. docker 版本更新记录: github讨论: 参开资料: https://github.com/docker/doc ...

  2. 使用dockerfile构建镜像(docker build)

    Docker buidl .  找出当前文件夹下的Docker build文件名的文件 Docker build -t  centos(镜像名) . 在当前目录下找centos的镜像文件 Docker ...

  3. Docker 使用指南 (六)—— 使用 Docker 部署 Django 容器栈

    版权声明:本文由田飞雨原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/98 来源:腾云阁 https://www.qclou ...

  4. 初试docker以及搭建mysql on docker

    前一阵阅读了google的borg论文,在最后的related works和总结中发现了kubernetes.从论文中了解的kubernetes这个东西很有意思,按照论文所说,它的实现有希望解决an ...

  5. docker: "build" requires 1 argument. See 'docker build --help'.

    http://bbs.csdn.net/topics/391040030 docker build  --tag="ouruser/sinatra:v3" -<Dockerf ...

  6. Docker 踩坑记(failed to build: Get https://registry-1.docker.io/v2/microsoft/dotnet/manifests/2.1-sdk: unauthorized: incorrect username or password)

    今天看了下.net core 示例项目eShopWebOnline. 无奈在使用docker的时候总是提示一下错误信息,大致信息是用户名密码错误.但是,明明桌面右下角Docker帐号处于登录状态. E ...

  7. Docker build Dockerfile 构建镜像 - 二

    Dockerfile 制作镜像 https://hub.docker.com/ 搜索需要镜像: https://hub.docker.com/_/centos/ 官方示例: centos:6 1.这里 ...

  8. Jenkins Docker安装及Docker build step插件部署配置

    生产部署环境:A:192.168.1.2 B:192.168.1.3  两台服务器系统均是Centos 7.3 , Docker版本都1.12.6 Jenkins安装操作步骤: 1.在A服务器上使用命 ...

  9. 25.week4 docker build 也就是创建自己的image 上传image到dockerhub 从dockerhub下载images

    dado可以写你自己的名字 这个命令就会根据目录下的Dockerfile(固定用和这个名字)文件里面的内容 去下载并创建运行命令一步一步地 Setting up libxfixes3:amd64 (: ...

随机推荐

  1. STM32介绍以及与通常ARM的区别

    ARM是英国的芯片设计公司,其最成功的莫过于32位嵌入式CPU核----ARM系列,最常用的是ARM7和ARM9,ARM公司主要提供IP核,就是CPU的内核结构,只包括最核心的部分,并不是完整的处理器 ...

  2. python处理文件

    打开文件:     open是内建函数,一个方法 open("test.txt","r",buffering=1) test.txt 表示被打开的文件名,如果不 ...

  3. 鸟哥的Linux私房菜-----16、程序与资源管理

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/ ...

  4. JavaScript原型及原型链

    代码一: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF- ...

  5. 当数据库没有备份,redo或undo损坏

    数据库在没有备份的情况下,如果数据库redo或undo损坏,可以通过如下方法处理,但是不一定成功 把init文件中的: undo_management=manual 然后启动数据库到mount 状态后 ...

  6. 截止频率-3db

    关于-3db截止频率 (2013-06-22 10:47:02) 转载▼   分类: 信号.电路 关于-3db截止频率 为什么当信号衰减了-3db的时候就算是截止频率了.这里面有什么高深的内涵.毕竟这 ...

  7. DC中检查脚本错误

    dcprocheck    +     要检查的tcl文件

  8. [D3] Select DOM Elements with D3 v4

    Before you can create dazzling data driven documents, you need to know how D3 accesses the DOM. This ...

  9. wepy小程序实现列表分页上拉加载(2)

    第一篇:wepy小程序实现列表分页上拉加载(1) 本文接着上一篇内容: 4.优化-添加加载动画 (1)首先写加载动画的结构和样式 打开list.wpy文件 template结构代码: <temp ...

  10. angular 引入material-ui

    第一步:安装material和cdk和animations,一个也不能缺,否则会报错. npm install --save @angular/material @angular/cdk @angul ...