Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use it in a docker compose file #2

Closed
sp90 opened this issue May 11, 2016 · 16 comments
Closed

Use it in a docker compose file #2

sp90 opened this issue May 11, 2016 · 16 comments

Comments

@sp90
Copy link

sp90 commented May 11, 2016

Hey kingsquare nice tool,

I would love to have this working in docker-compose have you tested it out:

right now i have the following config:

dbtunnel:
  container_name: dbtunnel
  image: tunnel (my own build of your container)
  volumes: 
    - $SSH_AUTH_SOCK:/ssh-agent
  command: 0.0.0.0:9200:192.168.3.10:9200 -L 0.0.0.0:15432:192.168.3.16:5432 -L 0.0.0.0:25432:192.168.3.19:5432 -L 0.0.0.0:6379:192.168.3.16:6379 -vvvv user@example.com
@fruitl00p
Copy link
Member

I would expect docker-compose to work the same way docker run would. Are you running into specific errors ? (remember to have the actual $SSH_AUTH_SOCK available on the host via the ssh-agent...)

@sp90
Copy link
Author

sp90 commented May 13, 2016

Its because it cant prompt me and ask for the password when its running all the containers in the same view

@fruitl00p
Copy link
Member

@sp90 but if you start the ssh-agent beforehand:

# start the ssh-agent in the background
eval "$(ssh-agent -s)"
Agent pid 59566

then the agent would already have your keys loaded?

@saranrapjs
Copy link

@sp90 which version of Docker/docker-compose are you using, and on what host?

@sp90
Copy link
Author

sp90 commented May 21, 2016

Docker mac: Version 1.11.1-beta12 (build: 7528)
Docker-compose: version 1.7.1, (build: 0a9ab35)

@saranrapjs
Copy link

So @sp90 I just (recently) ran into the same issue with the Docker for Mac beta build, trying to get this to work. After digging a bit, I'm pretty sure this is just a current limitation of the Docker for Mac beta. Per their help documentation:

File types
Symlinks, hardlinks, socket files, named pipes, regular files, and directories are supported. Socket files and named pipes only transmit between containers and between OS X processes -- no transmission across the hypervisor is supported, yet.

Because the ssh agent on a mac is a socket, it sounds like this isn't (yet) capable of being correctly mounted into the container w/ Docker for Mac.

@sp90
Copy link
Author

sp90 commented May 21, 2016

ahh makes sense 👍

fruitl00p added a commit that referenced this issue May 23, 2016
@kevin-cantwell
Copy link

Just to follow up on this. Using Docker for Mac, mounting ~/.ssh as a volume seems to work perfectly well:

docker run --rm -it -v $HOME/.ssh:/root/.ssh -p:[host_port]:[container_port] kingsquare/tunnel *:[container_port]:[destination_address]:[destination_port] [user]@[gateway_address]

@sp90
Copy link
Author

sp90 commented Apr 10, 2017

@kevin-cantwell and i agree, i've gotten it to worker later 👍

@fruitl00p
Copy link
Member

Cool. Should i add it somewhere in the docs for clearity?

@sp90
Copy link
Author

sp90 commented Apr 10, 2017

@fruitl00p maybe just a link to this issue, and a little text explaining that updating docker for mac solves the problem?

@fruitl00p
Copy link
Member

👍 see the commit 0018e20

@vce-xx
Copy link

vce-xx commented Apr 1, 2018

This docker-tunnel is nicely done.

I could pass my key as an argument and it worked like a sharm. However, I couldn't get it to work with the ssh-agent with Docker for Mac and I am quite puzzled by the Mac support note in the readme (pointing to this thread) and which I interpreted as "now it should be working".

According to @saranrapjs the ssh agent on a mac is a socket and cannot be correctly mounted with Docker for Mac.

This is confirmed by those Docker for Mac issues $SSH_AUTH_SOCK is not being forwarded to docker and Support for sharing unix sockets #483 this is indeed a Docker for Mac limitation. As of today, both issues (open is Aug 2016) are still Open.

According to @kevin-cantwell : "Just to follow up on this. Using Docker for Mac, mounting ~/.ssh as a volume seems to work perfectly well"

Mounting ~/.ssh wasn't enough to have the ssh-agent authentication work for me with Docker for Mac Version 18.03.0-ce-mac58.

What would be the actual status about making docker-tunnel work with SSH_AUTH_SOCK and the current versions of Docker for Mac ?

@fruitl00p
Copy link
Member

@vce-xx i'm not a mac user and have particular other issues with docker on mac's through a collegue of mine... Thus I wont be able to assist here... Will ping some docker/mac users to see how they do it

@vce-xx
Copy link

vce-xx commented Apr 3, 2018

@fruitl00p I could work around the Docker for Mac limitation with docker-ssh-agent-forward. docker-tunnel works perfectly on my Mac now. Thanks.

@fruitl00p
Copy link
Member

@vce-xx Awesome! I'll leave this open and await the pings from mac users in my vicinity :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants