Top Level Namespace

Defined Under Namespace

Modules: OS, VagrantPlugins

Instance Method Summary collapse

Instance Method Details



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/command.rb', line 68

def print_info(guest_ip, port, secrets_path, machine_uuid)
  # Print configuration information for accesing the docker daemon
  
  # extending the .docker path to include         
  secrets_path = File.expand_path(".docker", secrets_path)

  if !OS.windows? then
    message =
    <<-eos
# Set the following environment variables to enable access to the
# docker daemon running inside of the vagrant virtual machine:
export DOCKER_HOST=tcp://#{guest_ip}:#{port}
export DOCKER_CERT_PATH=#{secrets_path}
export DOCKER_TLS_VERIFY=1
export DOCKER_MACHINE_NAME=#{machine_uuid[0..6]}
# run following command to configure your shell:
# eval "$(vagrant adbinfo)"

    eos
    @env.ui.info(message)
  else
    # replace / with \ for path in Windows
    secrets_path = secrets_path.split('/').join('\\') + '\\'
    message =
    <<-eos
# Set the following environment variables to enable access to the
# docker daemon running inside of the vagrant virtual machine:
setx DOCKER_HOST tcp://#{guest_ip}:#{port}
setx DOCKER_CERT_PATH #{secrets_path}
setx DOCKER_TLS_VERIFY 1
setx DOCKER_MACHINE_NAME #{machine_uuid[0..6]}
    eos
    # puts is used here to escape and render the back slashes in Windows path
    @env.ui.info(puts(message))
  end 
end