Hello everyone! So this article will be on how you can create your own Docker registry hub and push your own Docker images to it. So before we start, here are the prerequisites. They're obvious, but let's make sure.
What a nice section I have added!
Posted on September 26, 2018413 views5 min read
Hello everyone! This is pretty much my blog section of my website. I'll most likely talk about things that are on my mind. Most likely just rants about things. For this first blog post, I'll just talk a little more about this website. So this website again is built on an application I wrote myself. This application has pretty much 4 parts to it.
# Bootstrap
The Bootstrap files are generally the core files in this application. These files pretty much dictate what can be called and what cannot. These files also initiate the Controller files, the Model files, and the View files.
# Controllers
The Controller files are typically what dictates what action to take next. Each URL has its own Controller file. For instance, if a user wants to go to the home page, the Controller file of the home page will determine if there is any data that needs to be grabbed. If there is, you can use the Controller file to call for a particular Model method. If the Controller file does not have anymore data to grab, the Controller file may then call for the View file. To call a Controller file in this application, you can simply do the below.
$this->call->controller('CONTROLLER_NAME', 'METHOD_NAME');
# Models
The Model files typically are instantiated in the beginning of the application during the Bootstrap process. This allows for easy use if you happen to want to use it within a Controller file. To access a Model file, you have to access the main Model class first. From there, you can then access your specific Model class. After doing so, you can then simply call for the method you want. Each specific Model class has to also follow a specific guideline. The specific Model class has to contain a .class.php file extension. The specific Model class also has to start with the filename and ending in Class. The class has to start with a capital letter as well. For a clear picture, use the following as an example.
Creating a specific model.
<?php
class MyRandomModelFileClass {
...
}
Calling a method
// Accessing main model class first.
$this->model();
// Accessing specific model class.
$this->model->myModelClass();
// And finally accessing desired method.
// This should be the correct line to use when trying to grab data from the database.
// The first two lines are just to demonstrate each level that you have to access in order to get to your desired method.
$this->model->myModelClass->myMethod();
# Views
The View files typically are for outputting/displaying things. That is pretty much their main purpose in this application. To call for a view file, you can simply do the below.
// If you don't need to pass anything to the view, this is as simple as it gets.
$this->render->view('VIEW_NAME');
// If you require passing data or any variables to the view, you can simply use an associative array as the 2nd argument.
// The indexed key does not necessarily have to use the same name as the original variable.
// However, do take note of what you call it once you want to output it to the screen.
$this->render->view('VIEW_NAME', [
'myRandomVariable' => $myRandomVariable
]);
So that being said, this whole website runs strictly in OOP. I am an OOP person so I mostly write everything in OOP. It's not really that difficult for me. The layout itself was inspired by Moo's template on Microsoft Word. I actually liked that layout and decided to replicate it. I tried reaching out to Moo's legal department asking if I could get the right permission to use this layout. Through a lot of phone calls, emails, and web chats, I was able to get a hold of someone who worked at Moo who said I am able to use this layout since it doesn't use the original layout that they had designed. I have screenshots of the conversation in case I get into legal issues. So that's all there is to it for this website.