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. InstallShield详细制作说明(二)

    四.设置安装的组件Component

  2. 字符设备驱动-------Linux异常处理体系结构

    裸机中断流程 外部触发 CPU 发生中断, 强制的跳到异常向量处 跳转到具体函数 保存被中断处的现场(各种寄存器的值) 执行中断处理函数,处理具体任务 恢复被中断的现场 Linux处理异常流程 异常发 ...

  3. word2vec源代码解析之word2vec.c

    word2vec源代码解析之word2vec.c 近期研究了一下google的开源项目word2vector,http://code.google.com/p/word2vec/. 事实上这玩意算是神 ...

  4. 2lession-文件访问

    今天继续学习python,因为是根据网上的教程,里面用到了一些例子,包含有后面的知识点.但是,因为自己稍微有点c.java等语言基础,所以并没有严格按照教程来学习,反而是遇到知识点就记录下来. 代码如 ...

  5. 使用Spring框架的好处

    转自:https://www.cnblogs.com/hoobey/p/6032506.html 在SSH框假中spring充当了管理容器的角色.我们都知道Hibernate用来做持久层,因为它将JD ...

  6. 1.2 Use Cases中 Log Aggregation官网剖析(博主推荐)

    不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Log Aggregation 日志聚合 Many people use Kafka ...

  7. 1.16 Python基础知识 - 装饰器初识

    Python中的装饰器就是函数,作用就是包装其他函数,为他们起到修饰作用.在不修改源代码的情况下,为这些函数额外添加一些功能,像日志记录,性能测试等.一个函数可以使用多个装饰器,产生的结果与装饰器的位 ...

  8. Java基础学习总结(53)——HTTPS 理论详解与实践

    前言 在进行 HTTP 通信时,信息可能会监听.服务器或客户端身份伪装等安全问题,HTTPS 则能有效解决这些问题.在使用原始的HTTP连接的时候,因为服务器与用户之间是直接进行的明文传输,导致了用户 ...

  9. Ubuntu 12.04 64bit GCC交叉编译器制作 原创

                                                                                                        ...

  10. android开发设计辅助工具整理

    1.Button设计工具button设计