Main Menu

Search

Showing posts with label Docker. Show all posts
Showing posts with label Docker. Show all posts

DOCKER: How To Create Bridge Network For Enabling Communication Between Docker Containers Running On Same Host? (DevOps)

FDocumentation on Docker Bridge Networks can be found at https://docs.docker.com/network/bridge/

Following are steps to create Bridge networks for Dockers

1. Create Bridge Network using below command.

docker network create -d bridge <bridge-network-name>

Following is sample output of above command. In this case we created network by name weblogic

#docker network create -d bridge weblogic
5c36fbc01eacef39387a3aec8d35324e523813bb27aa9508db7878f78af15e8d
 


2. Check if the Bridge network got created using below command.

docker network ls

Following is sample output of above command. In this case we see bridge network by name weblogic created.

# docker network ls
NETWORK ID NAME DRIVER SCOPE
a1d4a09ed294 bridge bridge local
79652466acbc host host local
b2376b3d239e none null local
5c36fbc01eac weblogic bridge local

 

3. For e.g. if you want to run docker container to use bridge network, docker run command has to be run with --net option. For e.g. below is the command.

docker run -d --net <bridge-network> -p port1:port2 <image-name>

 


Products to which Article Applies

Docker 

Search Keywords: Docker Dockers network networks bridge communication nw between container containers how to creating ping enable host hosts

Article Author: Tarun Boyella

 

DOCKER: How To Start Docker Container On Specific Port? (DevOps)

Docker Instance can be started on Specific port using below command

docker run -d -ti -p <port1>:<port2> <docker-image>

In above command port1 is for running docker container on that specific port on the host where docker is being started. port2 is the listen port of the application running inside the docker container. 


Products to which Article Applies

Docker Containers 

Search Keywords: docker dockers how to start specific port ports started starting instance instances container containers devops host hosts listen

Article Author: Tarun Boyella

 

DOCKER: Useful Docker Commands CheatSheet (DevOps)

Useful Docker Commands Cheatsheet


Stop Docker Container Instance - docker stop <container ID>


Remove All Docker Images - docker rmi $(docker images -q)


List Docker Processes - docker ps


List Docker Images - docker images


Pulling Docker Images - docker pull <image-name>


Connect To Run Command Within Running Docker Container - docker exec <container-id> <command>



Products to which Article Applies

Dockers 

Search Keywords: docker dockers command commands devops cheat sheet cheatsheet how to image images stop start list process processes container containers delete remove removing deleting start starting cloud

Article Author: Tarun Boyella

 

Linux: How to Install Docker Engine on Linux Machine?

Below are steps to install Docker Engine on Linux machine either VM or Baremetal standalone Physical machine.

1. Enable OL7 addons using below command.
yum-config-manager --enable ol7_addons

Below is sample output.
=============================== repo: ol7_addons ===============================
[ol7_addons]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7Server
baseurl = https://yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/
cache = 0
cachedir = /var/cache/yum/x86_64/7Server/ol7_addons
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7Server/ol7_addons/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7Server/ol7_addons/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
hdrdir = /var/cache/yum/x86_64/7Server/ol7_addons/headers
http_caching = none
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = Oracle Linux 7Server Add ons (x86_64)
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7Server/ol7_addons
pkgdir = /var/cache/yum/x86_64/7Server/ol7_addons/packages
proxy = http://XX.XX.XX.XX:80
proxy_dict = {'ftp': 'http://XX.XX.XX.XX:80', 'http': 'http://XX.XX.XX.XX:80', 'https': 'http://XX.XX.XX.XX:80'}
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = ol7_addons/x86_64
ui_repoid_vars = releasever,
   basearch
username =



2. Install docker-engine using below command.
yum install docker-engine

Above command takes sometime to complete as it has to install all the necessary dependency packages and addons.

Below is snippet of above command. Please note the output you will see when installing the dockers will not be apples to apples match to below sample output. It varies depending on the docker version being installed, OS version, packages installed and other factors.
Loaded plugins: ulninfo
ol7_UEKR5                                                | 2.5 kB     00:00
ol7_addons                                               | 2.5 kB     00:00
ol7_latest                                               | 2.7 kB     00:00
(1/7): ol7_UEKR5/x86_64/updateinfo                         |  34 kB   00:00
(2/7): ol7_addons/x86_64/updateinfo                        |  64 kB   00:00
(3/7): ol7_addons/x86_64/primary_db                        | 131 kB   00:00
(4/7): ol7_latest/x86_64/group                             | 810 kB   00:01
(5/7): ol7_latest/x86_64/updateinfo                        | 918 kB   00:00
(6/7): ol7_UEKR5/x86_64/primary_db                         | 4.8 MB   00:05
(7/7): ol7_latest/x86_64/primary_db                        |  16 MB   00:15
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:18.09.1.ol-1.0.8.el7 will be installed
--> Processing Dependency: runc < 1.0.0-20 for package: docker-engine-18.09.1.ol-1.0.8.el7.x86_64
--> Processing Dependency: container-selinux >= 2:2.77 for package: docker-engine-18.09.1.ol-1.0.8.el7.x86_64
--> Processing Dependency: libcgroup for package: docker-engine-18.09.1.ol-1.0.8.el7.x86_64
--> Processing Dependency: containerd for package: docker-engine-18.09.1.ol-1.0.8.el7.x86_64
--> Processing Dependency: docker-cli for package: docker-engine-18.09.1.ol-1.0.8.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.77-5.el7 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.77-5.el7.noarch
---> Package containerd.x86_64 0:1.2.0-1.0.5.el7 will be installed
---> Package docker-cli.x86_64 0:18.09.1.ol-1.0.8.el7 will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-cli-18.09.1.ol-1.0.8.el7.x86_64
---> Package libcgroup.x86_64 0:0.41-20.el7 will be installed
---> Package runc.x86_64 0:1.0.0-19.rc5.git4bb1fe4.0.4.el7 will be installed
--> Processing Dependency: criu for package: runc-1.0.0-19.rc5.git4bb1fe4.0.4.el7.x86_64
--> Running transaction check
---> Package criu.x86_64 0:3.9-5.el7 will be installed
--> Processing Dependency: libprotobuf-c.so.1(LIBPROTOBUF_C_1.0.0)(64bit) for package: criu-3.9-5.el7.x86_64
--> Processing Dependency: libnl-3.so.200(libnl_3)(64bit) for package: criu-3.9-5.el7.x86_64
--> Processing Dependency: libprotobuf-c.so.1()(64bit) for package: criu-3.9-5.el7.x86_64
--> Processing Dependency: libnl-3.so.200()(64bit) for package: criu-3.9-5.el7.x86_64
--> Processing Dependency: libnet.so.1()(64bit) for package: criu-3.9-5.el7.x86_64
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package policycoreutils-python.x86_64 0:2.5-29.0.1.el7_6.1 will be installed
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.4-4.el7 will be installed
---> Package libnet.x86_64 0:1.1.6-7.el7 will be installed
---> Package libnl3.x86_64 0:3.2.28-4.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package protobuf-c.x86_64 0:1.0.2-3.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved


================================================================================

 Package                Arch   Version                         Repository  Size
================================================================================
Installing:
 docker-engine          x86_64 18.09.1.ol-1.0.8.el7            ol7_addons  19 M
Installing for dependencies:
 audit-libs-python      x86_64 2.8.4-4.el7                     ol7_latest  76 k
 container-selinux      noarch 2:2.77-5.el7                    ol7_addons  37 k
 containerd             x86_64 1.2.0-1.0.5.el7                 ol7_addons  21 M
 criu                   x86_64 3.9-5.el7                       ol7_latest 432 k
 docker-cli             x86_64 18.09.1.ol-1.0.8.el7            ol7_addons  14 M
 libcgroup              x86_64 0.41-20.el7                     ol7_latest  66 k
 libnet                 x86_64 1.1.6-7.el7                     ol7_latest  57 k
 libnl3                 x86_64 3.2.28-4.el7                    ol7_latest 277 k
 libsemanage-python     x86_64 2.5-14.el7                      ol7_latest 112 k
 libtool-ltdl           x86_64 2.4.2-22.el7_3                  ol7_latest  48 k
 policycoreutils-python x86_64 2.5-29.0.1.el7_6.1              ol7_latest 455 k
 protobuf-c             x86_64 1.0.2-3.el7                     ol7_latest  27 k
 python-IPy             noarch 0.75-6.el7                      ol7_latest  32 k
 runc                   x86_64 1.0.0-19.rc5.git4bb1fe4.0.4.el7 ol7_addons 1.9 M
 setools-libs           x86_64 3.3.8-4.el7                     ol7_latest 620 k

Transaction Summary

================================================================================
Install  1 Package (+15 Dependent packages)

Total download size: 58 M

Installed size: 253 M
Is this ok [y/d/N]: y
Downloading packages:
(1/16): container-selinux-2.77-5.el7.noarch.rpm            |  37 kB   00:24
(2/16): criu-3.9-5.el7.x86_64.rpm                          | 432 kB   00:25
(3/16): audit-libs-python-2.8.4-4.el7.x86_64.rpm           |  76 kB   00:25
(4/16): docker-cli-18.09.1.ol-1.0.8.el7.x86_64.rpm         |  14 MB   00:13
(5/16): containerd-1.2.0-1.0.5.el7.x86_64.rpm              |  21 MB   00:45
(6/16): libnet-1.1.6-7.el7.x86_64.rpm                      |  57 kB   00:15
(7/16): libcgroup-0.41-20.el7.x86_64.rpm                   |  66 kB   00:15
(8/16): libsemanage-python-2.5-14.el7.x86_64.rpm           | 112 kB   00:00
(9/16): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm             |  48 kB   00:00
(10/16): libnl3-3.2.28-4.el7.x86_64.rpm                    | 277 kB   00:00
(11/16): protobuf-c-1.0.2-3.el7.x86_64.rpm                 |  27 kB   00:00
(12/16): python-IPy-0.75-6.el7.noarch.rpm                  |  32 kB   00:00
(13/16): policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64. | 455 kB   00:00
(14/16): setools-libs-3.3.8-4.el7.x86_64.rpm               | 620 kB   00:01
(15/16): docker-engine-18.09.1.ol-1.0.8.el7.x86_64.rpm     |  19 MB   00:18
(16/16): runc-1.0.0-19.rc5.git4bb1fe4.0.4.el7.x86_64.rpm   | 1.9 MB   00:15
--------------------------------------------------------------------------------
Total                                              817 kB/s |  58 MB  01:13
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : libcgroup-0.41-20.el7.x86_64                                1/16
  Installing : setools-libs-3.3.8-4.el7.x86_64                             2/16
  Installing : audit-libs-python-2.8.4-4.el7.x86_64                        3/16
  Installing : libnet-1.1.6-7.el7.x86_64                                   4/16
  Installing : protobuf-c-1.0.2-3.el7.x86_64                               5/16
  Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64                          6/16
  Installing : docker-cli-18.09.1.ol-1.0.8.el7.x86_64                      7/16
  Installing : python-IPy-0.75-6.el7.noarch                                8/16
  Installing : libnl3-3.2.28-4.el7.x86_64                                  9/16
  Installing : criu-3.9-5.el7.x86_64                                      10/16
  Installing : libsemanage-python-2.5-14.el7.x86_64                       11/16
  Installing : policycoreutils-python-2.5-29.0.1.el7_6.1.x86_64           12/16
  Installing : 2:container-selinux-2.77-5.el7.noarch                      13/16


3. Verify that the dockers is installed using below commands.
rpm -qa | grep -i docker

You should be seeing docker package installed.
docker help

Above docker help command should give the docker usage options.


Products to which Article Applies


Steps in this Article are tested on Oracle Linux Operating system. But yum steps should be similar for Redhat, Cent OS and other Linux Operating systems as well. 


All Host Operating Systems Using ILOM


Additional Reference