docker pull docker.io/httpd //直接这么运行会报“没有conf/httpd.cong这个文件” docker run -d --name httpd2.4 -p 80:80 -p 443:443 --restart=always -v $PWD/htdocs/:/usr/local/apache2/htdocs/ -v $PWD/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf -v $PWD/logs/:/usr/local/apache2/logs/ -d docker.io/httpd //先运行一个httpd然后从容器里面把/usr/local/apache2/文件夹复制出来 docker run -d --name httpd2.4 httpd docker stop httpd docker rm httpd //重新运行应该不会报错了 docker run -d --name httpd2.4 -p 80:80 -p 443:443 --restart=always -v $PWD/htdocs/:/usr/local/apache2/htdocs/ -v $PWD/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf -v $PWD/logs/:/usr/local/apache2/logs/ -d docker.io/httpd