Skip to content

Instantly share code, notes, and snippets.

@kennwhite
Last active December 2, 2015 21:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennwhite/979cd2f5d5d088083509 to your computer and use it in GitHub Desktop.
Save kennwhite/979cd2f5d5d088083509 to your computer and use it in GitHub Desktop.
Bundle Amazon/CentOS Linux to private Docker image repo
#!/usr/bin/env bash
#
# Bundling a minimal Amazon Linux image to a portable Docker container image
# Based on: https://forums.aws.amazon.com/message.jspa?messageID=541030#557755
#
#
yum install -y wget docker && service docker start
wget -q https://raw.githubusercontent.com/dotcloud/docker/master/contrib/mkimage-yum.sh
#
# Example for bundling AML Minimal HVM EBS Build: amzn-ami-minimal-hvm-2015.03.0.x86_64-ebs (ami-2ccae744)
# Image name shown is only suggested
bash mkimage-yum.sh amazon-linux-hvm-ebs-20150300-2ccae744
#
docker images
#
# Cache credentials
docker login registry.hub.docker.com
#
# Tag the newly-created image ID with a private repo tag (assumes username/aml private repo are already set up)
# Replace [repo-username] with the private repo username, ie, jsmith
docker tag [image-ID] registry.hub.docker.com/[repo-username]/aml
docker push registry.hub.docker.com/[repo-username]/aml
# [Log in to a CoreOS or another Docker container manager]
docker pull registry.hub.docker.com/[repo-username]/aml
# Create more friendly tag
docker tag registry.hub.docker.com/[repo-username]/aml local-aml
docker run -it local-aml bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment