Skip to content

Instantly share code, notes, and snippets.

@davidcurrie
davidcurrie / Dockerfile
Created November 28, 2016 17:22
Dockerfile with curl/jq
FROM ubuntu:latest
RUN apt-get update \
&& apt-get install -y curl jq \
&& rm -rf /var/lib/apt/lists/*
@davidcurrie
davidcurrie / cpu-usage.sh
Created November 28, 2016 17:22
Script to retrieve container CPU stats
#!/bin/bash
docker run -v /var/run/docker.sock:/var/run/docker.sock --rm curl bash -c 'names=$(curl -s --unix-socket /var/run/docker.sock http::/containers/json | jq -r ".[] | .Names[0]") \
&& for name in $names; do
name=${name:1}
stats=$(curl -s --unix-socket /var/run/docker.sock http::/containers/$name/stats?stream=false)
total_usage=$(echo $stats | jq .cpu_stats.cpu_usage.total_usage)
read=$(echo $stats | jq -r .read)
read_timestamp=$(date -d $read +%s%3N)
started=$(curl -s --unix-socket /var/run/docker.sock http::/containers/$name/json | jq -r .State.StartedAt)
started_timestamp=$(date -d $started +%s%3N)
@davidcurrie
davidcurrie / Dockerfile
Last active November 21, 2016 11:25
Dockerfile to create WebSphere Liberty Docker image with admin center enabled
FROM websphere-liberty:webProfile7
RUN mkdir -p /config/configDropins/overrides/ \
&& echo '<server>\
<featureManager><feature>adminCenter-1.0</feature></featureManager>\
<quickStartSecurity userName="wsadmin" userPassword="wsadmin"></quickStartSecurity>\
<remoteFileAccess><writeDir>${server.config.dir}</writeDir></remoteFileAccess>\
</server>' > /config/configDropins/overrides/adminCenter.xml \
&& installUtility install --acceptLicense defaultServer
@davidcurrie
davidcurrie / Dockerfile
Created October 3, 2016 20:23
Dockefile for WebSphere Liberty image with monitoring enabled
FROM websphere-liberty:webProfile7
RUN mkdir -p /config/configDropins/overrides \
&& echo "<server><featureManager><feature>monitor-1.0</feature>" \
"<feature>localConnector-1.0</feature></featureManager></server>" \
> /config/configDropins/overrides/monitoring.xml
@davidcurrie
davidcurrie / keybase.md
Created October 2, 2016 11:19
Keybase proof

Keybase proof

I hereby claim:

  • I am davidcurrie on github.
  • I am dcurrie (https://keybase.io/dcurrie) on keybase.
  • I have a public key ASAXesdpG1k_Q_yTwEvJSm-vCRabFSbfQZZUdTg471g4YQo

To claim this, I am signing this object:

@davidcurrie
davidcurrie / Dockerfile
Last active November 21, 2016 11:19
Dockerfile to build ferret application on WebSphere Application Server traditional Docker image
FROM websphere-traditional:profile
ENV FERRET_VERSION 1.2
RUN wget http://search.maven.org/remotecontent?filepath=net/wasdev/wlp/sample/ferret/$FERRET_VERSION/ferret-$FERRET_VERSION.war -O /tmp/ferret.war
RUN /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.sh -conntype NONE -lang jython -c "AdminApp.install('/tmp/ferret.war', '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname ferret_war -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -contextroot ferret -MapModulesToServers [[ ferret ferret.war,WEB-INF/web.xml WebSphere:cell=DefaultCell01,node=DefaultNode01,server=server1 ]] -MapWebModToVH [[ ferret ferret.war,WEB-INF/web.xml default_host ]]]' );AdminConfig.save()"
@davidcurrie
davidcurrie / Dockerfile
Last active May 30, 2016 21:41
Dockerfile for IBM Containers CLI
FROM ubuntu
RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*
RUN wget -O - "https://get.docker.com/builds/Linux/x86_64/docker-1.11.1.tgz" | tar -C /usr/local/bin --strip=1 -zxf -
RUN wget -O - "http://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar -C /usr/local/bin -zxf -
RUN cf install-plugin https://static-ice.ng.bluemix.net/ibm-containers-linux_x64 -f