Lemuntu

[Play Docker]How to build up an apache server in docker

1 858
Edited by john.wen at Jul 21, 2016 02:12

How to build up an apache server in docker


1. Introduction

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.


2. Install Docker

Please refer 《How to install docker on the Lemuntu》 to learn how to install docker. In this article, we will teach you how to install docker on Lemuntu.


3. Install apache server

(1) Search ubuntu docker image
  1. docker search armhf
Copy the Code


(2) Download ubuntu docker image
  1. docker pull armv7/armhf-ubuntu
Copy the Code


(3) Run ubuntu docker image
  1. sudo docker run -t -i -p 80:80 armv7/armhf-ubuntu /bin/bash
Copy the Code
-p 80:80 represents that apache server's 80 port is mapped to the host's 80 port.



(4) Install apache
  1. apt-get update
  2. apt-get install apache2
Copy the Code

(5) Start apache

  1. sudo apache2ctl -k start
Copy the Code
We can use netstat command to view servers and ports.




4. Open Web page
(1) Open apache's default page
We can use Iceweasel web browser to open apache's default page
Note that 192.168.0.63 is LeMaker Guitar's IP address.



We also can use google chrome webbrowser to open apache'default page



(2) Create a web page
A easy example is bellow:
  1. <html>
  2. <head>
  3. <tittle>Docker Apache Server on LeMaker Guitar<br /></tittle>
  4. </head>

  5. <br />
  6. <br />
  7. <br />

  8. <body>
  9. This is a test web page on docker.
  10. </body>
  11. </html>
Copy the Code
Save the file to /var/www/html/index.html

We will see as bellow:








It was good you mention that how to "Commit" and save the Docker Image after installing the applications.

Note for readers: Docker needs to be "Committed" and "Saved" into New Local/Remote Image to keep your modifications.
Otherwise, next time you back into Docker, all installation has gone ...




You have to log in before you can reply Login | Sign Up

Points Rules