Skip to content

Instantly share code, notes, and snippets.

@mbentley
mbentley / get_logs.ps1
Last active December 13, 2016 13:42
Windows Server 2016 Docker Daemon Logs
# from https://github.com/Microsoft/Virtualization-Documentation/blob/live/windows-server-container-tools/Debug-ContainerHost/Debug-ContainerHost.ps1#L175
Write-Output "Warnings & errors from the last 24 hours"
$logStartTime = (Get-Date).AddHours(-24)
$logNames = "Microsoft-Windows-Containers-Wcifs/Operational",
"Microsoft-Windows-Containers-Wcnfs/Operational",
"Microsoft-Windows-Hyper-V-Compute-Admin",
"Microsoft-Windows-Hyper-V-Compute-Operational",
"Application"
$levels = 3,2,1,0
@mbentley
mbentley / 1_create_client_bundle.sh
Created December 9, 2016 14:46
CI Automation with UCP
#!/bin/bash
# create directory for bundle in persistent storage
cd /var/lib/jenkins
mkdir ucp-bundle
cd ucp-bundle
set -e
# set variables for getting client bundle
@mbentley
mbentley / container_root_check.sh
Last active September 9, 2016 16:14
Check running containers for root processes
#!/bin/bash
# get a list of all running containers by name
for CONTAINER_NAME in $(docker ps --filter status=running --format '{{ .Names }}')
do
# get a list of the processes running in the container where the process is running as root
ROOT_PROCESSES="$(docker top ${CONTAINER_NAME} -o user,pid,ppid,command -U root -u root)"
# check and see if there are processes running as root; if not, do not display anything
if [ "$(echo "${ROOT_PROCESSES}" | grep ^root &>/dev/null; echo $?)" -eq "0" ]
@mbentley
mbentley / get_volume_mounts.sh
Created August 31, 2016 12:11
Get docker volume mounts via `docker inspect`
for i in $(docker ps -aq)
do
echo -n "Volumes for ${i}: "
docker inspect --format '{{ range .Mounts }}{{ .Name }} {{ end }}' ${i}
done
@mbentley
mbentley / docker-compose.yml
Last active August 19, 2016 02:46
Docker Network Example
version: "2"
services:
app1:
image: alpine:latest
command: ping app2
networks:
- discovery-demo
app2:
image: alpine:latest
@mbentley
mbentley / debian_8.sh
Last active August 8, 2022 22:05
Enable ttyS0 (Ubuntu 14.04 and Debian 8 (jessie)
### debian 8 (jessie)
mkdir /etc/systemd/system/serial-getty@ttyS0.service.d &&\
echo '[Service]
Environment="TERM=xterm"' > /etc/systemd/system/serial-getty@ttyS0.service.d/xterm.conf
systemctl daemon-reload &&\
systemctl enable serial-getty@ttyS0.service &&\
systemctl start serial-getty@ttyS0.service &&\
systemctl status serial-getty@ttyS0.service
@mbentley
mbentley / dns-r53.sh
Last active February 7, 2016 16:16
le dnsapi plugin for AWS Route 53
#!/bin/bash
# Dependencies:
# - awscli see https://docs.aws.amazon.com/cli/latest/userguide/installing.html for installation instructions
# - jq typically found as the package 'jq' on most distros
# AWS API keys
#AWS_ACCESS_KEY_ID=""
#AWS_SECRET_ACCESS_KEY=""
@mbentley
mbentley / dtr_install_error.log
Created November 23, 2015 16:43
DTR 1.4.0 Install Error
[root@ip-10-94-116-145 ec2-user]# sudo bash -c "$(sudo docker run docker/trusted-registry install)"
Unable to find image 'docker/trusted-registry:latest' locally
latest: Pulling from docker/trusted-registry
c63fb41c2213: Pulling fs layer
99fcaefe76ef: Pulling fs layer
5a4526e952f0: Pulling fs layer
1d073211c498: Pulling fs layer
202ea39d40d6: Pulling fs layer
6082dfdb8050: Pulling fs layer
ccb2a8e69485: Pulling fs layer
@mbentley
mbentley / setup.ps1
Last active April 4, 2016 19:07
Windows Server 2016 TP3 Docker Containers
### tp4
wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1
.\Install-ContainerHost.ps1
### tp5
wget -uri https://aka.ms/tp5/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1
Install-ContainerImage WindowsServerCore -ErrorAction Stop
.\Install-ContainerHost.ps1
@mbentley
mbentley / gist:008361909431d6fb39d7
Last active August 29, 2015 14:23
docker + libnetwork (overlay) quickstart
# install the kernel from utopic (on both nodes)
apt-get install -y linux-image-generic-lts-utopic
reboot
# install experimental docker release (on both nodes)
wget -qO- https://experimental.docker.com/ | sh
# install consul (on both nodes)
curl -OL https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
apt-get install -y unzip