Build 100kB Docker Images from Scratch

Posted on Mon 06 May 2019 in docker • Tagged with docker, c, scratch

📓 The Gist

You may think your 100mB Alpine images are small--but how about 100kB? Smaller images ship more quickly, and contain fewer attack vectors. Moreover, by optimizing images, you discover and isolate exactly what is needed for your app to run.

Let's Optimize.

There are two key characteristics of scratch-based docker images: 1. The Dockerfile has two build stages: * a builder--which contains all of the build dependencies including source, libraries and tools and.. * a final image, containing the binary and any run-time dependencies (config files, certificates and dynamically linked libraries) 2. The final image is FROM scratch -- the empty docker …

Continue reading

PHP Dev Environment One-Liner

Posted on Wed 17 April 2019 in php • Tagged with docker

Here's the fastest way to get your PHP app running. No MAMP, WAMP, apache or any of that nonsense.

Moreover, it allows you to run multiple projects independently.

I'm assuming you have docker.


This runs the php docker image, mounts the current directory, and spins up a server on port 8086

$ docker run -v $(pwd):/www -it -p8086:8086  php:5.6-alpine sh -c "cd www; php -S"

The Full Version

Create your index.php

$ cat > index.php
<html><body><h1><?php print("Hello World!") ?> </h1></body></html>

Run the Server

$ docker …
Continue reading

Get Started with Bitcoin Using Docker

Posted on Thu 30 November 2017 in bitcoin • Tagged with docker, bitcoin, secuity, tutorial

Like me, you're probably more comfortable on a CLI. Here's a quick way to use docker to set up a Bitcoin Wallet and trade Bitcoin for free on Testnet with Electrum. You can use the same tools to manage your real Bitcoin wallet too.


Make sure you have Docker for your OS ( Mac, Windows, Linux)

Run the electrum-cli docker image

Electrum is a python-based Docker wallet with a both a gui and good cli. I've put together electrum-cli, a lightweight Alpine-linux Docker image with Electrum signed and installed with jq.

docker run -it tonymet/electrum-cli

Create a wallet

First …

Continue reading

Using Custom Docker Images on Bitbucket Build Pipeline

Posted on Tue 28 November 2017 in docker • Tagged with docker, ci

Usually setting up the build dependencies is a major part of each build job. Thankfully, Atlassian's Bitbucket Pipelines, the new CI platform that integrates into Bitbucket, supports custom docker images.

To configure the build pipeline, you create bitbucket-pipeline.yml . This one uses our custom image (built below) and triggers builds whenever a releases-* tag is pushed.

image: tonymet/
      - step:
            - make sync_down_images
            - make s3_upload

That first line is the magic part -- you can run ANY public docker image from dockerhub (and private ones as well with further setup).

Building a Static Blog Using Build …

Continue reading

Creating TGZ artifacts from Docker Images to Enable Service Migrations

Posted on Tue 14 March 2017 in docker • Tagged with travis, ci, docker

A common migration pattern when moving to docker includes running some systems (e.g. dev, staging or a prod canary) on your docker image while the production app is still running your traditional tgz artifacts (e.g. your node app with node_modules)

Let's create a travis build that creates two artifacts: (1) your docker image and (2) a tgz from the docker container.

Let's assume you have a basic dockerfile with your app.js and a package.json. The key is that the app is built into /usr/src/app

FROM node:4

RUN mkdir -p /usr/src/app
Continue reading

Using the AWS EC2 Container Registry with EC2 Container Service

Posted on Wed 06 January 2016 in aws • Tagged with aws, docker, ecr, ecs

AWS announced recently that it's EC2 Container Registry (ECR) is now available. ECR simplifies hosting private images. Previously, you had to manually push your credentials to each EC2 instance -- likely a deliberate pain-point encouraging you to use ECR. With ECR, EC2 container hosts can easily fetch private images using IAM authentication.

Here are some of the gotchyas and stumbling blocks to help you get your repository up quickly and painlessly.


1. aws-cli should be 1.9.15 or greater.

# check Version
$ aws --version
# update via homebrew (osx) if needed
$ brew update
$ brew …
Continue reading