 In the last video, we have seen the architecture of OpenShift version 3. Now we'll look at an example of an application that runs on OpenShift version 3. Here, we are looking at an application that uses a database. So what you're seeing here is on the right side, you are looking at a database, a MySQL database running in its own part. This is a MySQL container running in MySQL part, frontended by a service that exposes port 3306. Now, the application code that accesses this database is PHP code running in a separate part, and this PHP source depends on this database exposed at port 3306. So this part expects the parameters such as where the database is running, the IP address of the part in which the database is running, the port number, the database name, username, password, etc. Those are configured in this part. And this part is available over port 80 for access outside by the client over HTTP or HTTPS. In this example, we are going to create a Docker image outside of OpenShift and use it with an OpenShift. So there are three different types of builds that you can do in OpenShift version 3. A Docker build, a source to image kind of build and a custom build. But I'm addressing a very simple example here. We are going to use a MySQL image from Docker hub here for deploying the MySQL service. And for the source code, we'll have our own source code, create a Docker image outside of OpenShift and use that with an OpenShift, deploy it with an OpenShift and use it to access this MySQL service. That's a common question a lot of people ask on can I create a Docker image, a pre-created Docker image and then use it with an OpenShift. And the answer is yes. I am now logged on to Docker hub. And since we need a MySQL database, let us search for it. Let's use this first MySQL image. It's a plain MySQL. So I'm also logged on on the other side to my OpenShift version 3 environment as user Joe. Now in OpenShift version 3 in the current beta that we have, the way to create an application, it would require a JSON file. And this might look a little tedious at this point of time. There will be an easier way of creating applications very soon. Let's look at the JSON file that's there right now. You can see here, this JSON file is going to use a container and it's pointing to an image called MySQL. As you can see, this is going to be using the MySQL from Docker hub. And at the same time, when this container gets created, we are telling this container to initiate itself by creating a database with the name sample, provide a root password of super secret and things like that. This container would expose port 3306 as we talked before. Now at the same time, we are also creating a service that would look for a label MySQL label on all the containers. So when you go back and see here, this container would have a MySQL label and this is what the service looks for. So the service will again expose a port 3306 and that's it. That's the content of this JSON file. I'll quit and let's create a pod by using this MySQL JSON. So all I'm going to do is see create from the file. Now this creates two different things. One is the pod itself which runs the MySQL container and it also creates a service with this name MySQL service. So let's look at what pods are running and what services are running. Now you have a pod called MySQL pod that is in the running status and you have a service called MySQL service that's running at this particular IP address and at port 3306. Now at the same time, I'm also logged on to this OpenShift environment as an administrator here on the other side. Now let's look at what Docker containers are running here. If you see there is the MySQL is running here and here is the name of my Docker container. We take a copy of that. Let's try to log on to this Docker container. Now I'm inside the container now and at the same time, I'll try to get on to the database to see what is inside. So let me pick up the host name. This is the IP address of the service and the port number is 3306. I'm going to log in as a root user and with the password Supersecret. Now I'm logged on to the MySQL client. Now let's see what databases are in here. As you can see, we wanted it to create a sample database and it's there. So let's use that database. Now that I'm using the sample database, it won't have any tables because we didn't do anything with it. Let me create a table. Let me insert some values into it. So I added two rows. Now I'll exit from this container. So I have a database. I have a table in the database and I have some values in the database.