1
0

run.ps1 893 B

12345678910111213141516171819202122
  1. # Run docker-compose in a container via boot2docker.
  2. #
  3. # The current directory will be mirrored as a volume and additional
  4. # volumes (or any other options) can be mounted by using
  5. # $Env:DOCKER_COMPOSE_OPTIONS.
  6. if ($Env:DOCKER_COMPOSE_VERSION -eq $null -or $Env:DOCKER_COMPOSE_VERSION.Length -eq 0) {
  7. $Env:DOCKER_COMPOSE_VERSION = "latest"
  8. }
  9. if ($Env:DOCKER_COMPOSE_OPTIONS -eq $null) {
  10. $Env:DOCKER_COMPOSE_OPTIONS = ""
  11. }
  12. if (-not $Env:DOCKER_HOST) {
  13. docker-machine env --shell=powershell default | Invoke-Expression
  14. if (-not $?) { exit $LastExitCode }
  15. }
  16. $local="/$($PWD -replace '^(.):(.*)$', '"$1".ToLower()+"$2".Replace("\","/")' | Invoke-Expression)"
  17. docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -v "${local}:$local" -w "$local" $Env:DOCKER_COMPOSE_OPTIONS "docker/compose:$Env:DOCKER_COMPOSE_VERSION" $args
  18. exit $LastExitCode