Skip to content

Instantly share code, notes, and snippets.

@davidino
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidino/43f12abdf59e024b9d63 to your computer and use it in GitHub Desktop.
Save davidino/43f12abdf59e024b9d63 to your computer and use it in GitHub Desktop.
ssh command forwarding

In this way i can run command directly in the vm

vm fig run
vm docker ps -a

vm will change the virtual machine directory accordling to my local ( mac ) directory

In that way you can expose the docker service outside from the Virtual machine.

# /lib/systemd/system/docker.service
ExecStart=/usr/bin/docker -d -H tcp://0.0.0.0:2375 -H fd://

then

systemctl daemon-reload && sudo service docker restart

So assuming that your vm ip is : 172.16.210.130

export DOCKER_HOST=tcp://172.16.210.130:2375

You will be able to use you local docker command.

#!/bin/bash
locale="\/Users\/davidino"
remote="\/home\/obaley/"
cdir=`echo $(pwd) | sed "s/${locale}/${remote}"`
ssh -t in "cd $cdir; $@"
@unlucio
Copy link

unlucio commented Jun 16, 2015

interesting idea! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment