[Docker] Build Your Own Custom Docker Image
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.0.tar.gz // then you are able to see tegine-2.2.0 folder cd tengine-2.2.0 // 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.0.tar.gz WORKDIR /opt/tengine-2.2.0 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 80 443 CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
Now we can build our image:
docker build -t zwan/tengine:2.2.0 .
Check images:
dcoker images
Run image:
docker run -p 8000:80 zwan/tengine:2.2.0
Then check localhost:8000.
分类:
Docker
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2016-04-25 [Javascript] Advanced Function Scope
2016-04-25 [Angular 2] Get start with Firebase
2016-04-25 [Docker] Docker Client in Action