Question: How to find the running docker storage device when docker is using the device-mapper storage driver and then check the size of it? 1. Please run the “docker info” command to display docker system-wide information which contains the docker storage info. # docker info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 […]
DevOps
Understanding “docker stats” Command Output
Question: How to monitor a running docker container performance metrics. For example, CPU,memory, I/O and network stats? The docker stats command can continuously report the basic CPU, memory, network and disk I/O metrics. For example: # docker stats a3f78cb32a8e CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS […]
Docker Basics – Expose ports, port binding and docker link
This post illustrates three methods to link Docker containers. Expose ports and port binding Expose ports This method is used for within the same network or the docker host. Containers on the same network can talk to each other over their exposed ports and you can expose the ports by one of the below methods. […]
How to add new host entry in /etc/hosts when a docker container is run
This post shows how to add host-entries onto /etc/hosts on docker container when it is run. For the purpose of this post, we are using CentOS/RHEL 7 host. But this should work on any Linux host capable of running latest docker versions. Generally speaking, /etc/hosts file can not be modified before running the docker container. […]
How to Configure Nagios NRPE Client for System Monitoring (CentOS/RHEL)
Question: How to configure CentOS/RHEL system as Nagios NRPE Client so it can be monitored from Nagios-Server for system health/performance? Enable EPEL REPO (Fedora Repository) and Install Required Packages 1. Download the epel repository packages for CentOS/RHEL 5 and 6. FOR CentOS/RHEL 6: # wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm For CentOS/RHEL 5: # wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm 2. Install Epel […]
How to Trace Python Scripts using trace.py
More and more scripts for administrative tasks on Linux OS are written by Python. This post aims to introduce a tool to trace Python statement execution. Python is a dynamic object-oriented programming language which can be used to develop various types of software. It offers strong support for integration with other languages and tools and […]
How to Access Docker Container’s Network Namespace from Host
This post is to illustrate how to access the docker container’s network namespace. 1. Identify the docker container id you want to access and run below command as root on host. # docker ps 2. Get docker container’s PID: # pid=$(docker inspect -f ‘{{.State.Pid}}’ ${container_id}) 3. Create netns directory: # mkdir -p /var/run/netns/ 4. Create […]
How To Change The Time Zone For A Docker Container
The goal of this post is to set up the timezone on the container to match the same timezone on the Docker server, this will allow users to see the same time in both instances (Docker Server and Container). Most of the time Containers do not use the same time as the Docker server, this […]
How To Access Kubernetes Dashboard Externally
Following is an alternative workaround to access Dashboard externally. 1. kubernetes-dashboard is a service file which provides dash-board functionality, to edit this we need to edit dashboard service and change service “type” from ClusterIP to NodePort: [root@kubeXXXX]# kubectl -n kube-system edit service kubernetes-dashboard # Please edit the object below. Lines beginning with a ‘#’ will […]
New User Failed Run Kubectl with Error “The connection to the server xxx.xxx.xxx was refused – did you specify the right host or port?”
The Problem When run kubectl from a new created user, failed with error: The connection to the server xxx.xxx.xxx was refused – did you specify the right host or port? The Solution A newly created user has no KUBECONFIG configured. Setup kubernetes configuration for the new user: # mkdir -p $HOME/.kube # sudo cp -i […]