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

Q: How do you connect to the SSHD example? #1674

Closed
alexellis opened this Issue Apr 20, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@alexellis
Contributor

alexellis commented Apr 20, 2017

I built the "moby" CLI and then ran build/run on the SSHD example on my Mac. I can see the system booted, but it's not clear how to connect to it. Is that even possible?

https://github.com/linuxkit/linuxkit/blob/master/examples/sshd.yml

@MagnusS

This comment has been minimized.

Show comment
Hide comment
@MagnusS

MagnusS Apr 20, 2017

Contributor

The new linuxkit instance will be on the same network as the Docker for Mac VM, so you should be able to connect to it from containers. You could also forward the port (e.g. with socat) so you can connect directly from the host.

For example:

$ docker run -p 127.0.0.1:8080:8080 -it --rm alpine sh
/ # apk -U add socat
[...]
/ # socat TCP-LISTEN:8080,fork TCP:[linuxkit_vm_ip]:22

([linuxkit_vm_ip] is the IP of eth0 in the linuxkit vm)

And then connect to localhost on the host:

$ ssh -o StrictHostKeyChecking=no localhost -p 8080 -l root
[...]
Welcome to LinuxKit
moby-025000000030:~#
Contributor

MagnusS commented Apr 20, 2017

The new linuxkit instance will be on the same network as the Docker for Mac VM, so you should be able to connect to it from containers. You could also forward the port (e.g. with socat) so you can connect directly from the host.

For example:

$ docker run -p 127.0.0.1:8080:8080 -it --rm alpine sh
/ # apk -U add socat
[...]
/ # socat TCP-LISTEN:8080,fork TCP:[linuxkit_vm_ip]:22

([linuxkit_vm_ip] is the IP of eth0 in the linuxkit vm)

And then connect to localhost on the host:

$ ssh -o StrictHostKeyChecking=no localhost -p 8080 -l root
[...]
Welcome to LinuxKit
moby-025000000030:~#
@alexellis

This comment has been minimized.

Show comment
Hide comment
@alexellis

alexellis Apr 24, 2017

Contributor

Great - thanks for this. Also detailed with SSH in http://blog.alexellis.io/boot-linuxkit-in-10-mins/ (for Googlers)

Contributor

alexellis commented Apr 24, 2017

Great - thanks for this. Also detailed with SSH in http://blog.alexellis.io/boot-linuxkit-in-10-mins/ (for Googlers)

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