Latest Article

LearnITGuide.net really glad to help the beginners who are interested to learn the kubernetes from basics to become an experienced level. So links are arranged in order to take you in a clear direction to follow. Go through the links one by one to understand the kubernetes easily from beginning. Videos are also available for some topics. Make use of it, Share it with your friends and groups. We appreciate your feedback, Leave your comments if any.

Kubernetes Tutorial for Beginners - Kubernetes Free Training

1. What is Kubernetes - Learn Kubernetes from Basics
Document Link

Topics Covered:
1. What is Kubernetes? Introduction to Kubernetes
2. Advantages of Kubernetes
3. Kubernetes Architecture
4. Kubernetes Components

2. How to Install & Configure Kubernetes Cluster on CentOS 7 / RHEL 7
Document Link

Topics Covered:
1. How to enable Kubernetes repository on master and all worker nodes
2. How to install the required packages on master and all worker nodes
3. How to start and enable docker and kubelet services on master and all worker nodes
4. How to allow network ports in firewall on master and all worker nodes
5. How to initialize and setup the kubernetes cluster
6. How to install network add-on to enable the communication between the pods
7. How to join all worker nodes with kubernetes master node

3. How to Create Kubernetes Deployment, Services & Pods Using Kubectl
Document Link
[ads-post]
Topics Covered:
1. What is Deployment in Kubernetes?
2. What is Pod in Kubernetes?
3. How to Create Deployment and Pods?
4. What is Service in Kubernetes?
5. How to Create Kubernetes Service?

4. How to Create Kubernetes Deployment, Services & Pods using YAML
Document Link

Topics Covered:
1. Examples of Kubernetes Deployment YAML File
2. How to Create Kubernetes Deployment using YAML File
3. How to Apply YAML Files for Kubernetes Deployment
4. How to Create Kubernetes Services using YAML File
5. How to Apply YAML Files for Kubernetes Services



More topics will be added soon. stay connected with us on social networking sites and Subscribe our YouTube channel for more updates.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss 
Incoming Searches : kubernetes tutorial ppt, kubernetes tutorial video, kubernetes tutorial youtube, kubernetes tutorial centos, kubernetes tutorial linux, kubernetes tutorial redhat, kubernetes free training, kubernetes, kubernetes tutorial, kubernetes Administration, kubernetes training, kubernetes Administration training, kubernetes administration fundamentals, kubernetes training, Professional kubernetes training, kubernetes training videos, kubernetes training guides, kubernetes tutorial for beginners, kubernetes training videos, kubernetes tutorials, kubernetes online tutorials, kubernetes training, kubernetes components, kubernetes wiki, kubernetes download, kubernetes architecture, kubernetes free training, kubernetes free tutorials, kubernetes free online tutorial, kubernetes free online training, kubernetes best tutorial, kubernetes, kubernetes tutorial, best kubernetes site, kubernetes training, learning kubernetes, kubernetes explained, kubernetes beginner tutorial, kubernetes tutorial for beginners

This post explains you about how docker port mapping or docker port forwarding that helps to bind the container ports with docker host in order to access the applications running on the containers through network.

In the previous posts, already we have explained the below topics. Refer these links to understand this topic from basics.

What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
Dockerfile Instructions Explained with Examples
How to Write Dockerfile To Build Your Own Docker Images
Docker ONBUILD Command Explained with Examples
Docker ARG vs ENV Command Differences Explained in Detail

Let's get started.
Understanding Docker Port Mapping to Bind Container Ports
By default, When we create any containers that doesn't publish or expose the application ports running on the containers. So, we can access these applications only within the docker host not through network systems.
[root@docker-host ~]# docker run -d -it --name container1 docker.io/httpd
ec649e19885f2006cfe1d199d6c9f844b4fc1024dbe54c2d2dcd5dcaedbefc0f
I have created one container for httpd apache web service with name container1.

This container has got IP Address 172.17.0.2 from bridged network "docker0" and running on port 80. But these httpd service port is not published, so we can access it only using the assigned IP address locally within the docker host.
[root@docker-host ~]# curl 172.17.0.2:80
<html><body><h1>It works!</h1></body></html>
Its working now locally, In order to access these applications or any services through network, We must publish the ports while running the container itself using "p" or "-P" options. This will create a firewall rule to bind the container port to a docker host port.
[root@docker-host ~]# docker run -d -it --name container2 -p 8080:80 docker.io/httpd
7795205e821829732a780bf09b7ac03fb0cfaf9ab342ba68b4e3b752431e9303
Now, I have created a container2 with the option "-p 8080:80" to expose the container port 80 with docker host port 8080. So Users must use the docker host IP Address (192.168.2.1) to access the containers through network with published port (8080). This would reach the docker host first (192.168.2.1:8080) and forward the connection request to the respective containers (8080 -> 80), refer the above diagram for clear idea.
[ads-post]
So, We have Container1 and Container2 which are running on same docker host. Each containers have got the local IP Address 172.17.0.2 and 172.17.0.3 respectively. But, Container1 port is not published, but container2 port is published. So we can access these both applications locally using respective local IP address. Additionally, We can access container2 application externally through network 192.168.2.1:8080, because this port is published.
[root@docker-host ~]# curl 192.168.2.1:8080
<html><body><h1>It works!</h1></body></html>
To know the port mappings of the containers, use docker port command as below.
[root@docker-host ~]# docker port container1
[root@docker-host ~]# docker port container2
80/tcp -> 0.0.0.0:8080
Above output shows that, container1 doesnt have any port mapping rules, but container2 has port mapping rules.

Also, We can use "-P" option for automapping. This option would use any random port number to publish. So we dont need to provide the publish port with container port number.

For example, Let's create a "container3" with "-P" option and list the port mapping of the container.
[root@docker-host ~]# docker run -d -it --name container3 -P docker.io/httpd
2634717516b75111a0b9f2336faa7a49cc2f13146c65a94a6e82442b6a2fad7c
[root@docker-host ~]# docker port container3
80/tcp -> 0.0.0.0:32769
This time, it has published the application port with random port number 32769. So we can access the container3 application through network using 32769 port.
[root@docker-host ~]# curl 192.168.2.1:32769
<html><body><h1>It works!</h1></body></html>
Some of the Useful options are,

-p 8080:80 : Map TCP port 80 in the container to port 8080 on the Docker host.
-p 192.168.1.100:8080:80 : Map TCP port 80 in the container to port 8080 on the Docker host for connections to host IP 192.168.1.100.
-p 8080:80/udp : Map UDP port 80 in the container to port 8080 on the Docker host.
-p 8080:80/tcp -p 8080:80/udp : Map TCP port 80 in the container to TCP port 8080 on the Docker host, and map UDP port 80 in the container to UDP port 8080 on the Docker host.

Hope you have got an idea about how to bind container ports using docker port mapping or docker port forwarding. Going forward, we will play more with docker tool.

Also refer other articles,

What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
Dockerfile Instructions Explained with Examples
How to Write Dockerfile To Build Your Own Docker Images
Docker ONBUILD Command Explained with Examples
Docker ARG vs ENV Command Differences Explained in Detail
Docker CMD & ENTRYPOINT Differences Explained in Detail

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss 
Incoming searches: Docker Port Mapping, Bind Container Port, port mapping, docker port forwarding, link docker container, connect docker containers, docker port mapping examples, docker port mapping to host, docker port mapping command, docker port mapping syntax, docker port mapping running container, docker port forwarding, docker port forwarding examples, docker port forwarding syntax, docker port forwarding command, docker port binding, docker port binding examples, docker port binding command, access docker container from host, access docker container from outside network

This post shows you How to Install Docker on Ubuntu 18.04 with step by step procedure. End of this post, you will be able to understand how to install docker on Ubuntu 18.04.

Steps involved in this Docker Installation,
1. How to enable repository for docker?
2. How to Deploy Docker’s official GPG key?
3. How to Install Docker using apt-get command?
4. How to Verify Docker information?

In the previous posts, already we have explained the below topics. Refer those links to understand this topic from basics.

What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
Dockerfile Instructions Explained with Examples
How to Write Dockerfile To Build Your Own Docker Images
Docker ONBUILD Command Explained with Examples
Docker ARG vs ENV Command Differences Explained in Detail
Docker CMD & ENTRYPOINT Differences Explained in Detail

Lets get started.

How to Install Docker on Ubuntu 18.04

1. How to enable repository for docker?

On Ubuntu 18.04:
Before installing docker on ubuntu, update the packages index using the 'apt-get update' command as below.
sudo apt-get update
Output:
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Reading package lists... Done
Once you have updated your packages index, lets deploy the Docker’s official GPG key and install Docker.
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Output:
OK
Now, enable the repository.
sudo add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
Output:
Get:1 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [2,033 B]
Hit:4 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Fetched 66.5 kB in 1s (97.1 kB/s)
Reading package lists... Done
2. How to Install Docker on Ubuntu 18.04?
[ads-post]
Use "apt-get install" command to install docker with required dependencies automatically.
sudo apt-get install docker.io
Output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  bridge-utils cgroupfs-mount ubuntu-fan
Suggested packages:
  aufs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils
The following NEW packages will be installed:
  bridge-utils cgroupfs-mount docker.io ubuntu-fan
0 upgraded, 4 newly installed, 0 to remove and 55 not upgraded.
Need to get 30.1 MB of archives.
After this operation, 137 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 bridge-utils amd64 1.5-15ubuntu1 [30.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 cgroupfs-mount all 1.4 [6,320 B]
Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 docker.io amd64 17.12.1-0ubuntu1 [30.1 MB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 ubuntu-fan all 0.12.10 [34.7 kB]
Fetched 30.1 MB in 33s (924 kB/s)
Preconfiguring packages ...
Selecting previously unselected package bridge-utils.
(Reading database ... 174991 files and directories currently installed.)
Preparing to unpack .../bridge-utils_1.5-15ubuntu1_amd64.deb ...
Unpacking bridge-utils (1.5-15ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.4_all.deb ...
Unpacking cgroupfs-mount (1.4) ...
Selecting previously unselected package docker.io.
Preparing to unpack .../docker.io_17.12.1-0ubuntu1_amd64.deb ...
Unpacking docker.io (17.12.1-0ubuntu1) ...
Selecting previously unselected package ubuntu-fan.
Preparing to unpack .../ubuntu-fan_0.12.10_all.deb ...
Unpacking ubuntu-fan (0.12.10) ...
Setting up docker.io (17.12.1-0ubuntu1) ...
Adding group `docker' (GID 128) ...
Done.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket â /lib/systemd/system/docker.socket.
Processing triggers for ureadahead (0.100.0-20) ...
Setting up cgroupfs-mount (1.4) ...
Setting up bridge-utils (1.5-15ubuntu1) ...
Setting up ubuntu-fan (0.12.10) ...
Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service â /lib/systemd/system/ubuntu-fan.service.
Processing triggers for systemd (237-3ubuntu10.3) ...
Processing triggers for man-db (2.8.3-2) ...
Processing triggers for ureadahead (0.100.0-20) ...
We have successfully installed docker as expected. Lets verify the docker information.

4. How to Verify Docker information?

Use below docker command with "-v" option to know the docker package version with build release information.
docker -v
Output:
Docker version 17.12.1-ce, build 7390fc6
Also we can use "version" argument along with docker command to know the relevant information about the docker package.
sudo docker version
Output:
Client:
 Version:       17.12.1-ce
 API version:   1.35
 Go version:    go1.10.1
 Git commit:    7390fc6
 Built: Wed Apr 18 01:23:11 2018
 OS/Arch:       linux/amd64
Server:
 Engine:
  Version:      17.12.1-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.10.1
  Git commit:   7390fc6
  Built:        Wed Feb 28 17:46:05 2018
  OS/Arch:      linux/amd64
  Experimental: false

That's all about the Installation of Docker on Ubuntu 18.04, Its pretty straight forward. Going forward, we will play more with docker tool.

Also refer other articles,

What is Docker - Get Started from Basics - Docker Tutorial
What is Container, What is Docker on Container - Get Started
How to Install Docker on CentOS 7 / RHEL 7
Docker Images Explained with Examples - Docker Tutorial
Dockerfile Instructions Explained with Examples
How to Write Dockerfile To Build Your Own Docker Images
Docker ONBUILD Command Explained with Examples
Docker ARG vs ENV Command Differences Explained in Detail
Docker CMD & ENTRYPOINT Differences Explained in Detail

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss 
Relevant Incoming Searches : docker, install docker, docker ubuntu, how to install docker, what is docker, installing docker, docker install, docker installation, install docker on ubuntu, install docker on centos, install docker on redhat, install docker on ubuntu, how to install docker on ubuntu, install docker ubuntu, download docker, how to download docker, docker tutorial, docker install ubuntu, ubuntu docker install, docker setup ubuntu, installing docker ubuntu, step by step docker install, installing docker

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget