exposing dockerised apache on ubuntu page, from azure


Recall that we are running an ubuntu host in azure vm fabric, with azure extensions for docker.

image

we built an apache-enhanced ubuntu image and launched it on that docker host.

 

###########################################
# Dockerfile to build an apache2 image
###########################################
# Base image is Ubuntu
FROM ubuntu:14.04

# Author: Dr. Peter
MAINTAINER Dr. Peter <peterindia@gmail.com>

# Install apache2 package
RUN apt-get update && \
     apt-get install -y apache2 && \
     apt-get clean

# Set the log directory PATH
ENV APACHE_LOG_DIR /var/log/apache2

# Launch apache2 server in the foreground
ENTRYPOINT [“/usr/sbin/apache2ctl”, “-D”, “FOREGROUND”]

 

To build the image, we use

docker build -t apache2 .

to run the image in a container with exposed endpoints, we use

docker run -d -p 80:80 apache2

To ensure that the container hosts own port 80 is itself exposed as an azure endpoint, we configure azure (to expose the docker hosts port 80..,)

image

 

allowing us to interact with http://pwdocker3.cloudapp.net/ from the public internet:

image

End.

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in docker. Bookmark the permalink.