Skip to content

Instantly share code, notes, and snippets.

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size

@ChrisMcKee
ChrisMcKee / biggest_relations.sql
Created May 11, 2023 10:18 — forked from seejee/biggest_relations.sql
Postgres Maintenance Scripts
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_relation_size(C.oid)) AS "size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;
@ChrisMcKee
ChrisMcKee / restoreDB.sql
Created March 29, 2021 16:42 — forked from RobsonAutomator/restoreDB.sql
restore RDS database from S3
-- Change [bucket] with your bucket name
exec msdb.dbo.rds_restore_database
@restore_db_name='Sitecore_Analytics',
@s3_arn_to_restore_from='arn:aws:s3:::[bucket]/Sitecore_Analytics.bak';
exec msdb.dbo.rds_restore_database
@restore_db_name='Sitecore_Core',
@s3_arn_to_restore_from='arn:aws:s3:::[bucket]/Sitecore_Core.bak';
@ChrisMcKee
ChrisMcKee / pack-man.ps1
Last active July 31, 2020 14:04 — forked from rjmurillo/pack-man.ps1
Useful Package Manager console commands
Get-Project –All | Add-BindingRedirect
# On large projects commands like `Update-Package -Reinstall` can take HOURS
# If the updates are broken up, then don't lock up the IDE and complete much faster (minutes vs hours)
# Reinstall all packages that match a specific targetFramework
# Useful when retargeting
gci -recurse packages.config | % { [xml]$XmlDocument = Get-Content -Path $_.FullName; $XmlDocument.packages.package | ? { $_.targetFramework -eq 'net462' } | select id | sort-object -unique | % { update-package -reinstall $_.id } }
# Reinstall all packages that have been marked with requireReinstallation
@ChrisMcKee
ChrisMcKee / uk-number-plate-validation.md
Created April 9, 2020 10:32 — forked from danielrbradley/uk-number-plate-validation.md
Regular Expression to Validate UK Number Plates

Regular Expression to Validate UK Number Plates

Regular Expression

(?<Current>^[A-Z]{2}[0-9]{2}[A-Z]{3}$)|(?<Prefix>^[A-Z][0-9]{1,3}[A-Z]{3}$)|(?<Suffix>^[A-Z]{3}[0-9]{1,3}[A-Z]$)|(?<DatelessLongNumberPrefix>^[0-9]{1,4}[A-Z]{1,2}$)|(?<DatelessShortNumberPrefix>^[0-9]{1,3}[A-Z]{1,3}$)|(?<DatelessLongNumberSuffix>^[A-Z]{1,2}[0-9]{1,4}$)|(?<DatelessShortNumberSufix>^[A-Z]{1,3}[0-9]{1,3}$)|(?<DatelessNorthernIreland>^[A-Z]{1,3}[0-9]{1,4}$)|(?<DiplomaticPlate>^[0-9]{3}[DX]{1}[0-9]{3}$)

For use in JavaScript (with named groups removed):

(^[A-Z]{2}[0-9]{2}\s?[A-Z]{3}$)|(^[A-Z][0-9]{1,3}[A-Z]{3}$)|(^[A-Z]{3}[0-9]{1,3}[A-Z]$)|(^[0-9]{1,4}[A-Z]{1,2}$)|(^[0-9]{1,3}[A-Z]{1,3}$)|(^[A-Z]{1,2}[0-9]{1,4}$)|(^[A-Z]{1,3}[0-9]{1,3}$)|(^[A-Z]{1,3}[0-9]{1,4}$)|(^[0-9]{3}[DX]{1}[0-9]{3}$)
@ChrisMcKee
ChrisMcKee / generate_new_kubeconfig.sh
Created March 29, 2019 12:51 — forked from Oats87/generate_new_kubeconfig.sh
This bash script will sign an x509 certificate using the kube-ca located on any rancher node. This allows you to gain access back to your RKE-created kubernetes cluster should you lose the kube_config and cluster.yml for it, but still have SSH access to the hosts.
#!/bin/bash
echo "This will generate a new kube config for accessing your RKE-created kubernetes cluster. This script MUST be run on a Kubernetes node."
echo "Please enter the IP of one of your control plane hosts, followed by [ENTER]:"
read cphost
openssl genrsa -out kube-admin.key 2048
openssl req -new -sha256 -key kube-admin.key -subj "/O=system:masters/CN=kube-admin" -out kube-admin.csr
sudo openssl x509 -req -in kube-admin.csr -CA /etc/kubernetes/ssl/kube-ca.pem -CAcreateserial -CAkey /etc/kubernetes/ssl/kube-ca-key.pem -out kube-admin.crt -days 365 -sha256
sudo rm -f /etc/kubernetes/ssl/kube-ca.srl
@ChrisMcKee
ChrisMcKee / kubernetes-dashboard.md
Last active October 30, 2018 13:34 — forked from superseb/README.md
Deploy kubernetes-dashboard on Rancher 2.0 cluster exposed using NodePort

Deploy kubernetes-dashboard on Rancher 2.0 cluster exposed using NodePort

Requirements

Step 1: Generate kubeconfig from the UI

Generate the kubeconfig file for your cluster using the Kubeconfig File button in the Cluster view of your cluster. Save the generated file as $HOME/.kube/config and run kubectl get nodes to verify it works.

@ChrisMcKee
ChrisMcKee / Breach Compilation (1.4 billion credentials) in Postgres.md
Created October 26, 2018 12:22 — forked from spacepatcher/Breach Compilation (1.4 billion credentials) in Postgres.md
This gist is a simple guide of effective storing 1.4 billion email and password pairs in PostgreSQL for fast searching and reducing required storage space

What would you need:

Hardware requirements

@ChrisMcKee
ChrisMcKee / BuildWarningReportGenerator.ps1
Last active August 2, 2019 10:41 — forked from tarwn/BuildWarningReportGenerator.ps1
Powershell script for TeamCity build warnings (fixed for 2018 / removed guest from end of urls used to fetch last builds log file)
Param
(
[parameter(Mandatory=$true)][string]
$BuildLogPath,
[parameter(Mandatory=$true)][string]
$BuildCheckoutDirectoryPath,
[parameter()][string]
$BuildArtifactRepositoryUrl
@ChrisMcKee
ChrisMcKee / install_packer_vagrant.md
Last active February 13, 2018 15:14 — forked from knu2xs/install_packer_vagrant.md
Packer + Vagrant on Ubuntu 16.04.1 LTS