How to create a new Docker image?

maxresdefaultIn this article we’re going to build one new docker image with Apache and PHP installed and one php file for test.

Create a directory called “build”:

# mkdir ˜/build

Change to directory “build”:

# cd ˜/build

Create a new file called Dockerfile with the following content:

FROM centos
MAINTAINER Daniel Nascimento
RUN yum update -y
RUN yum install httpd php -y
ADD index.php /var/www/html/
CMD /usr/sbin/apachectl -D FOREGROUND
EXPOSE 80

In the same directory create another file called index.php with the following content:

<?php
phpinfo();
?>

Finally it’s time of build our new image.

# docker build -t user/httpd .

Now we have a new image with apache and php installed. Then let’s create a new container using this image:

# docker run -t -i -p 80:80 user/httpd

To access our new container in your browser type the URL:

http://your-host-ip/

That’s it! 🙂

How to create a new OpenShift Origin user?

Basic Auth is used by default by the OpenShift Origin. So to create a new user account using the below command:

#htpasswd /etc/openshift/htpasswd username

Environment:

  • OpenShift V2
  • Centos 6 – 64Bits

Reference:

http://docs.openshift.org/origin-m4/oo_deployment_guide_comprehensive.html#configure-an-authentication-plugin