This image contains
debian:jessie base image with added
vim and a statically built docker binary (taken from
boot2docker). Use this image to build a disposable docker build environment on CoreOS, avoiding the pollution of the CoreOS host.
Mount the host's docker server socket into the image:
# docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock communitycloud/docker-builder Unable to find image 'communitycloud/docker-builder:latest' locally Pulling repository communitycloud/docker-builder a1be0046a8dc: Download complete 511136ea3c5a: Download complete 16386e29a1f4: Download complete 835c4d274060: Download complete 1c801018fb2f: Download complete 21982675376f: Download complete be614e31068e: Download complete Status: Downloaded newer image for communitycloud/docker-builder:latest
Now we can work with the host's docker server:
root@042c9197b157:/# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE communitycloud/docker-builder 1.4.1 a1be0046a8dc 25 hours ago 215.6 MB communitycloud/docker-builder latest a1be0046a8dc 25 hours ago 215.6 MB
Once the image boots, we have access to the host docker server and images. Any images built or ran from the disposable build environment will be stored and run on the host.
The workflow is thus:
- Run a new disposable docker builder
- Build the binary if needed by apt-getting necessary files, etc.
- Build the docker image
- Test the image by running containers from the disposable environment
- Push the docker image to the repository
- Dispose the environment.
- The image will already be available on the host, since the environment was mapped to its docker server through the socket.