Skip to content

Instantly share code, notes, and snippets.

Avatar

Olli Janatuinen olljanat

  • Finland
View GitHub Profile
@olljanat
olljanat / overlay-network-and-static-ips-for-docker-containers.md
Last active Mar 18, 2020
Overlay network and static IPs for Docker containers
View overlay-network-and-static-ips-for-docker-containers.md

I don't expect moby/moby#24170 to be solved by Docker team on near future so this gist is about looking for least ugly workarounds which are available today and on near future.

What is possible on Docker 19.03

Network

It is possible to create overlay network with use user specified subnet. On this example I create network which is size is two C -class networks ( IP range 10.0.0.0 - 10.0.1.255 ) and force Docker to use IPs from second part of it ( 10.0.1.0 - 10.0.1.255 ).

That way I can make sure that IPs 10.0.0.2 - 10.0.0.254 can be specified to containers and they do not collide with IPs which Docker engine assign for service(s)/container(s).

@olljanat
olljanat / MigrateVmIPsToIPAM.ps1
Last active Mar 20, 2019
Nutanix AHV - Migrates specified virtual machines IP addesses to IPAM reservations to avoid two IPs to be reserved per server
View MigrateVmIPsToIPAM.ps1
<#
.SYNOPSIS
Migrates specified virtual machines IP addesses to IPAM reservations to avoid two IPs to be reserved per server
.DESCRIPTION
Finds servers which have two reserved IP addresses,
removes old NIC and add new NIC with second IP (static IP inside of VM).
Can be run online but causes small network hickup for servers.
@olljanat
olljanat / Find-OrphanDockerLayers.ps1
Last active May 4, 2020
Find Windows containers orphan layers
View Find-OrphanDockerLayers.ps1
param (
[switch]$RenameOrphanLayers
)
If ($RenameOrphanLayers) {
Write-Warning "$($env:COMPUTERNAME) -RenameOrphanLayers option enabled, will rename all orphan layers"
}
# Get known layers on Docker images
[array]$ImageDetails += docker images -q | ForEach { docker inspect $_ | ConvertFrom-Json }
You can’t perform that action at this time.