Docker installation run apache2 server do image server method

  • 2020-06-15 10:37:48
  • OfStack

1. Install


docker pull httpd 

Create folders


mkdir -p /usr/docker_data/statics / /usr/docker_data/httpd/logs/ /usr/docker_data/httpd/conf/ 

statics folder map image file store path logs map log file path conf map profile file path

3. Test run httpd


docker run -it --name test-httpd httpd bash

4. Go to the conf folder and copy the ES17en.conf file to /usr/docker_data/httpd/conf/

5. Modify httpd. conf


 will Options Indexes FollowSymLinks Replace with Options FollowSymLinks

The purpose is to set the path information that cannot be accessed, only through the file name

6. Stop and delete the container ES33en-ES34en that you just tested

7. Officially run httpd


docker run --restart=always --privileged=true --name httpd -p 98:80 -v /usr/docker_data/statics/:/usr/local/apache2/htdocs/ -v /usr/docker_data/httpd/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf -v /usr/docker_data/httpd/logs/:/usr/local/apache2/logs/ -v /etc/localtime:/etc/localtime:ro -d httpd 

8. External access to images via the http:IP:98/ image file path


Related articles: