Use fig and docker-machine to deploy remotely

I use docker-machine to easily create docker hosts on AWS.

Locally I use fig (or docker-compose) to start the various microservices associated with a service.

  • Docker image load failed on mac, error is 'invalid argument'
  • Why does setfacl not work in docker container?
  • Pass AWS credentials (IAM role credentials) to code running in docker container
  • /bin/sh: 1: apk: not found while creating docker image
  • How to prevent binding to docker0 bridge in overlay mode
  • How to expose ports defined in EXPOSE without explicitly setting ports via CLI options?
  • Is it possible for fig to use the config variables set by the docker-machine command:

     docker-machine config host
    

    So when I do:

    fig up
    

    Fig creates the service on the host set by docker-machine and not the local one?

  • supervisor curl command failing with exit 56 error
  • Cannot stop or kill Docker image
  • Docker: Unable to specify port for a running container
  • using docker for win10 to build image, and found the COPY command changed the new line
  • Docker nginx error at mounting config file
  • Docker: use file in local folder
  • One Solution collect form web for “Use fig and docker-machine to deploy remotely”

    I haven’t tried to do this with a remote host but I have it working with a vmwarefusion based machine. Because fig respects some of the DOCKER_ environment variables you can modify them to point to your docker host. Try something like this:

    $(docker-machine env host); docker-compose up
    

    Edited previous approach (referenced in comments):

    #!/bin/bash
    
    # modify path and host with output from > docker-machine config host
    DOCKER_CERT_PATH=~/.docker/machines/.client/
    DOCKER_HOST=tcp://172.16.124.216:2376
    DOCKER_TLS_VERIFY=1
    
    fig up
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.