Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Bash – Running In Docker?

Posted on October 26, 2020August 17, 2024 By David Kittell
docker=$(cat /proc/self/cgroup | awk -F/ '$2 == "docker"')

if [ ! -z "$docker" ]; then
    echo "Running in Docker"
else
    echo "Not running in Docker"
fi
Originally Posted on October 26, 2020
Last Updated on August 17, 2024
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code Docker

Post navigation

Previous post
Next post

Related Posts

Remove duplicates in a string array

Posted on September 1, 2015October 26, 2015

//error_reporting(E_ALL); //ini_set(‘display_errors’, 1); echo "<p>Original:<br/>".$_GET[’input’]."</p>"; $pieces = explode(",", $_GET[’input’]); $result = array_unique($pieces); echo "<p>Updated:<br/>"; foreach($result as $print) { echo "$print,"; } echo "</p>"; Originally Posted on September 1, 2015Last Updated on October 26, 2015 All information on this site is shared with the intention to help. Before any source code…

Read More

UNIX Terminal – Secure Copy (SCP)

Posted on May 31, 2016May 31, 2016

Secure Copy (SCP) is a useful UNIX command that allows you to securely copy files and directories between your local machine and a remote computer. In the examples below “-P 22” is not actually needed if the SSH port is 22. Many of the servers I connect to have a…

Read More

NetSuite – SuiteScript 1.0 – Useful Functions

Posted on August 31, 2018

These first function snippets are from https://gist.github.com/W3BGUY // function to figure out the number of days in month. function getDaysInMonth(thisMonth,thisYear){ var monthArray=[31,28,31,30,31,30,31,31,30,31,30,31]; if(thisMonth!=2){return monthArray[thisMonth-1]}; if(thisYear%4!=0){return monthArray[1]}; if(thisYear%100==0 && thisYear%400!=0){return monthArray[1]}; return monthArray[1]+1; } // NetSuite usage example nlapiLogExecution(‘DEBUG’,getDaysInMonth(11,2016)) // function to add leading zeros on date parts. function zeroPad(num,len){ var…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes