基于busybox镜像使用Dockerfile创建httpd测试
1、创建Dockerfile专用目录,并进入该目录;
mkdir DockerFile && cd DockerFile
2、创建Dockerfile文件,注意Dockerfile文件名称第一个字母必须大写;
vim Dockerfile
3、按需编辑Dockerfile;
FROM busybox:latest RUN echo "<h1> This is V1<h1>" >/tmp/index.html CMD ["/bin/httpd", "-f", "-h", "/tmp"]
4、构建docker镜像;
docker build -t "registry.cn-hangzhou.aliyuncs.com/mustbeso/busybox:v4" -f Dockerfile .
基于busybox构建httpd访问主页显示主机名实例Dockerfile:
FROM busybox:latest CMD echo `/bin/hostname`>/tmp/index.html && httpd -f -h /tmp

浙公网安备 33010602011771号