Docker learning (9) docker deploy static website

One: dockerfile, put Dockerfile and myfolder in one directory:

FROM httpd:2.4

COPY ./myfolder/  /usr/local/apache2/htdocs/

WORKDIR /usr/local/apache2/

RUN chown -R daemon:daemon htdocs &&\
    chmod -R 755 htdocs

Two: Generate an image:

        docker build -t imageName . (note the dot at the end)

Three: httpd opens port 80. Execute the container:

         docker  run -p 9009 : 80 imageName 

Four: You can view the contents of the mirror :

           docker ps | grep "9009" find the container ID is XXXID

           docker exec -it XXXID  sh

        Then you can see what's inside.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325077128&siteId=291194637