Docker Compose will publish your source code for free in Docker 1.12

Super big notice!

Docker has fixed this, as noted in their awesome comment. Leaving the original contents around for now, thanks Docker!


I was honestly debating whether or not to publish this post or not… on Wednesday, I’m planning to go live with the fully dockerized version of this blog and trying not to make any changes to the current live version. However, I was playing with the new Docker 1.12 this morning and some of the new features. If you have a docker-compose.yml file that has something like this:

version: '2'
  services:
    nginx:
      build: images/nginx
      image: boomtownroi/flagship-nginx:latest
      extends:
        file: common.yml
        service: common
      volumes_from:
        - files
      ports:
        - '80:80'
        - '443:443'

and happen to run the new

docker-compose bundle
command, you will find it magically start pushing your container to Docker Hub. If by chance your Docker Hub permissions are set to the default of “public”, you will find your source code published right on Docker Hub.

Granted, there are a few things you’d have to have in your build:

  • interpreted source code (php, js, etc)
  • the sources added to the container in the docker build step

This is an important caveat that I just wanted to make sure the world was aware of.

  • Aanand Prasad

    Compose maintainer here. This was already a known issue and fixed in master, but there’s now a new RC out with the fix: https://github.com/docker/compose/releases/tag/1.8.0-rc2

    From the release notes: “`docker-compose bundle` no longer automatically pulls and pushes images if digests are missing, instead printing an error. You can force it to automatically push/pull with `–fetch-digests`.”

    RC2 should make it into the Docker for Mac and Windows beta release soon.