Skip to content

CoursePark/docker-compose-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

docker-compose-deploy

Environment Variables

Docker Machine Host

The remote docker machine host to connect to:

DOCKER_HOST: tcp://213.121.126.215:2376

Docker Compose Dir Name

Docker compose won't see running containers on a host unless they are prepended with an expected name. The name it expects if the current directories name (the last directory in the path).

DOCKER_COMPOSE_DIR_NAME: app-name

Docker TLS

DOCKER_TLS_VERIFY: '1'

Docker Machine Cert Bundle

Convert a docker-machine cert bundle for sharing by taring and base64 encoding the ca.pem, cert.pem, and key.pem files like the following:

DOCKER_MACHINE_CERT=

tar -c ca.pem cert.pem key.pem | gzip | base64 | pbcopy

Docker Compose

Docker compose can combine mulptiple docker-compose.*.yml and env files into a single docker-compose.yml output using docker-compose config but it kinda messes things up when doing it. The following command uses some seds to correct the small problems docker compose creates for itself.

So instead of needing fancy docker-compose -f ... -f ... up only a docker-compose up can be used.

In the following example replace -f ... with the series of -f options that would be used for docker-compose to interact with a particular environment and configuration.

DOCKER_COMPOSE=

docker-compose -f ... config | sed "s|:rw\$||" | sed "s|\\$|\$\$|" | gzip | base64 | pbcopy

Docker Hub Credentials

If using private repositories on Dockerhub the credentials will be needed.

DOCKER_CREDENTIAL=

cat dockercfg | gzip | base64 | pbcopy

Codeship Usage:

Mac Instructions for encrypting the above base64 encoded environment variables for secure use in codeship-services.yml or codeship-steps.yml:

Append an encoded environment variable value to the environment variable name with =. For instance DOCKER_MACHINE_CERT=BASE64_ENCODED_VALUE_SEE_INSTRUCTIONS_ABOVE. Copy the whole key value pair as a string and use the following to encrypt it.

pbpaste > raw.tmp && jet encrypt raw.tmp crypt.tmp && cat crypt.tmp | pbcopy && rm raw.tmp crypt.tmp

The value can now be added an array item to a encrypted_environment in codeship-services.yml or codeship-steps.yml.

About

Deploy Dockerhub Images to a Docker machine host

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published