Build Docker Images with Packer and Ansible
Create a base docker image from current OS: Uses Yum and assumes internet connection to yum repository.
If your organisation has a base linux build, this is an easy way of making Docker images of it.
Mount DVD if internet access not available and add mount to yum repositories.
Get the script:
curl https://raw.githubusercontent.com/docker/docker/master/contrib/mkimage-yum.sh >mkimage-yum.sh
Make it executable:
chmod 777 mkimage-yum.sh
Create a docker image of the current OS; image_name can use domains e.g. companyName/centos-6.6:
./mkimage-yum.sh [optional_yum_repository_path] <image_name>
The Docker Image is automatically added to the docker inventory.
List Docker Images:
docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
companyName/centos-6.6 6.7 20498809d9d5 17 minutes ago 168.2 MB
Run a docker image interactively (-i):
docker run -ti --name=<display_name> <repository>:<tag> /bin/bash
[root@c0cb45bf0efb /]#