Maybe a lot of you have already heard and maybe even mastered Docker. This is my first docker image and I’ll like to share some basic concepts I have learned from it.
I will also appreciate any comment to improve this image.
So, what is Docker?
Wikipedia: “Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux”
I see it like a nice way to automate tasks (avoid repeating the same task over and over) and making a container of it, allowing me to use it “where ever” I want.
Basic Docker Operations:
docker build -t [username]/[imagename] [Dockerfile path]
docker build -t mfh/webtier /home/docker/webtier/.
This will use a Dockerfile stored in “/home/docker/webtier/” to create an image called “mfh/WebTier”.
docker run [arguments] [image]
docker run -p 80:80 mfh/webtier
docker run -it mfh/webtier /bin/bash
docker run -d -p 80:80 mfh/webtier
This will display the docker containers currently running and its name and id.
docker exec [running container id]
docker exec -it c357930de48c /bin/bash
This will allow you to look into a running container.
We constantly have clients using a front end server to receive all the incoming requests and then send it to the final destination. In terms of Oracle this will mean, Apache Web Server with mod_wl.so redirecting to WebLogic ( More than half of the clients use OHS).
- Create a Dockerfile
- Download and / or create external files.
- Build Dockerfile
- Run the Docker container
This file was based on appcontainers/apache.
FROM centos:centos7 MAINTAINER email@example.com ENV APP_NAME apache.local ENV APACHE_LOG_DIR /var/log/httpd # Clean, Update, and Install... then clear non English local data. RUN yum clean all && \ yum -y update && \ # Install required packages yum -y install httpd24.x86_64 mod_rewrite mod_ssl mod_env && \ # Remove yum cache this bad boy can be 150MBish yum clean all && \ rm -fr /var/cache/* # Remove locales other than english RUN for x in `ls /usr/share/locale | grep -v -i en | grep -v -i local`;do rm -fr /usr/share/locale/$x; done && \ for x in `ls /usr/share/i18n/locales/ | grep -v en_`; do rm -fr /usr/share/i18n/locales/$x; done && \ rm -fr ca* den men wen zen && \ cd /usr/lib/locale && \ localedef --list-archive | grep -v -i ^en | xargs localedef --delete-from-archive && \ mv -f locale-archive locale-archive.tmpl && \ build-locale-archive ADD apache-config.conf /etc/httpd/conf.d/ # Copy site CMD ["mkdir", "/var/www/html"] ADD site /var/www/html/ # Expose ports EXPOSE 80 EXPOSE 443 #Copy Apache HTTP Server Plug-In COPY ./mod_wl/lib/*.so /usr/lib64/httpd/modules/ COPY mod_wl.conf /etc/httpd/conf.d/ COPY mod_wl.load.conf /etc/httpd/conf.modules.d/ #Create Volume VOLUME ["/var/www/html", "/var/log/httpd"] # Start apache. CMD /usr/sbin/httpd -D FOREGROUND
To run the container:
docker run -d -p 80:80 -v ~/docker/webtier/html:/var/ww/html webtier
More information regarding Docker: