1.下载httpd镜像
[root@Ieat1 data]# docker pull httpd:2.4
2.4: Pulling from library/httpd
f189db1b88b3: Pull complete
ba2d31d4e2e7: Pull complete
23a65f5e3746: Pull complete
5e8eccbd4bc6: Pull complete
4c145eec18d8: Pull complete
1c74ffd6a8a2: Pull complete
1421f0320e1b: Pull complete
Digest: sha256:25964df5467106d74b727b8fb4a1b9b0092f4882cefc4c13c34ca36caeaa3889
Status: Downloaded newer image for httpd:2.4
2.运行容器
假设/data/apache2
是你的文件服务根目录
[root@Ieat1 data]# docker run -dit --name apache2 -p 12345:80 -v /data/apache2:/usr/local/apache2/htdocs/ httpd:2.4
ec2e8061682d3b12bf1290971715c36726ffe72f1ab19151a48ea8c4068bc206
3.访问 http://localhost:12345/
将test.jpg放到/data/apache2
目录