Prepare a vanilla server by installing docker, curl, and sshpass. If a file called ``dot_dockercfg``
    exists in the current working directory, it is uploaded as ``~/.dockercfg``.

    Args:
        * docker_mount=None: Partition that will be mounted as /var/lib/docker

def setup(docker_mount=None, force=False):
    '''
    Prepare a vanilla server by installing docker, curl, and sshpass. If a file called ``dot_dockercfg``
    exists in the current working directory, it is uploaded as ``~/.dockercfg``.

    Args:
        * docker_mount=None: Partition that will be mounted as /var/lib/docker
    '''

    if not is_ubuntu() and not is_boot2docker():
        raise Exception('Head In The Clouds Docker is only supported on Ubuntu')

    # a bit hacky
    if os.path.exists('dot_dockercfg') and not fabric.contrib.files.exists('~/.dockercfg'):
        put('dot_dockercfg', '~/.dockercfg')

    if not fabric.contrib.files.exists('~/.ssh/id_rsa'):
        fab.run('ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa')

    if docker_is_installed() and not force:
        return

    for attempt in range(3):
        sudo('wget -qO- https://get.docker.io/gpg | apt-key add -')
        sudo('sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"')
        with settings(warn_only=True):
            sudo('apt-get update')
            failed = sudo('apt-get install -y lxc-docker sshpass curl').failed
            if not failed:
                break

    if docker_mount:
        create_docker_mount(docker_mount)