Storing Images and Running Containers

Storing Images

Docker Hub :

Docker Hub is a service provided by Docker for finding and sharing container images.

Visit https://hub.docker.com and create an account to store your images.

You can create any number of public repositories. Docker providers only one private repository for free. If you want more no.of private repositories, you can upgrade the plan.

We can push the image to the docker hub with “docker push” command. Before that, we need to do two things:

  1. Login to the docker hub using “docker login” command and provide username and password. Once successfully authenticated, you don’t need to login every time until you logged out using “docker logout” command.
  2. Tag the image with repository name and tag (or version number) using docker tag command.
$ docker login
Username:
Password:
Login Succeeded
$

 

$ docker images
REPOSITORY TAG    IMAGE ID     CREATED       SIZE
mywebsite  latest 44870583de0c 2 minutes ago 380MB
centos     7      1e1148e4cc2c 2 months ago  202MB
$
$ docker tag 44870583de0c learninghub/website:1.0
$ docker push learninghub/website:1.0
The push refers to repository [docker.io/learninghub/website]
bc6f85aad9de: Pushed
1d1fc5de57b2: Pushed
071d8bd76517: Mounted from library/centos
1.0: digest: sha256:4ff5eef21cc80f609d20064c62cf2f9caa3c27a363324732c9d83442b141beb3 size: 948
$

 

We can also store the images in the private repositories offered by different cloud providers.

  • Elastic Container Registry by AWS
  • Azure Container Registry by Microsoft Azure
  • Google Container Registry by Google
  • Docker Trusted Registry by Docker
  • Docker Registry by Quay.io 
  • And more…..

We can run our own local registry using docker “registry” image. 

$ docker run -d -p 5000:5000 
--restart always 
--name registry 
registry:2

To Store images in the local registry, tag the image with localhost:5000.

$ docker tag 44870583de0c localhost:5000/website:1.0
$ docker push localhost:5000/website:1.0

Run Containers

Run containers using the docker images with “docker run” command.

Syntax : docker run [options] image:tag

$ docker run -d 
--name mywebsite 
-p 8080:80 
mywebsite:latest
1c63111fed79a373b4cdc2ede2bf72f33139e0d90e124eec999790b47c65af8d
$

Here, -d for run in background ( as daemon), -p for to map host to container port (HostPort:ContainerPort).

To check the running containers, use “docker ps” commands.

$ docker ps
CONTAINER ID IMAGE            COMMAND                CREATED       STATUS       PORTS                NAMES
1c63111fed79 mywebsite:latest "/usr/sbin/httpd -D …" 4 minutes ago Up 4 minutes 0.0.0.0:8080->80/tcp mywebsite

Now, access the website using http://HOST-IP:8080

To run the container use, “kubectl run” command or create a yaml.

$ kubectl run  mywebsite --image=learninghub/website:1.0
deployment.apps "mywebsite" created

To check the pods, use kubectl get pods 

$ kubectl get pods
NAME                       READY STATUS  RESTARTS AGE
mywebsite-5c588f6774-zmlzp 1/1   Running 0        54s

To Access the website, we have to create a service for this deployment, using “kubectl expose” command.

$ kubectl expose deployment mywebsite --port=80 --type=NodePort
service "mywebsite" exposed

You can access the website using worker node IP address.

If you have kubernetes cluster in the cloud, you can create a service with load balancer as well.

Oracle DB installation – Windows

You have to download Oracle Database server software from Oracle website as per your operating system. Here we have downloaded 11g R2 64bit version.

Oracle Database 11g Release 2 (11.2.0.1.0) for Microsoft Windows (x64)
win64_11gR2_database_1of2.zip (1,213,501,989 bytes)
win64_11gR2_database_2of2.zip (1,007,988,954 bytes)

After downloading the above two files, extract them in a single directory database and under that you will find the following sub-directories.

Files

Step 1

Launch the Oracle Database Installer using the setup file. You can provide your email ID and check the checkbox as shown in the following screenshot. Click the Next button.

oracle_install_step1

Step 2

Select the first option Create and Configure Database using the radio button and click the Next button to proceed.

oracle_install_step2.jpg

Step 3

Select the Desktop Class option as we not not installing on server and click the Next button to proceed.

oracle_install_step3.jpg

Step 4

Provide a location, where you will install the Oracle Server. Just modify the Oracle Base and the other locations will set automatically. You will also have to provide a password, this will be used by the system DBA. Once you provide the required information, click the Next button to proceed.

oracle_install_step4.jpg

Step 5

Again, click the Next button to proceed.

oracle_install_step5.jpg

Step 6

Click the Finish button to proceed. This will start the db server installation.

oracle_install_step6.jpg

Step 7

This will take a few moments, until Oracle starts performing the required configuration.

oracle_install_step7

Step 8
Here, Oracle installation will copy the required configuration files.

oracle_install_configuration1

Once the database files are copied, you will see the below dialogue box. Click the OK button.

oracle_install_configuration2.jpg

Once installation completed, you will see the below final window.

oracle_install_step8

Now verify your installation. open command prompt, use the below command.

sqlplus “/ as sysdba”

Commandprompt