Docker Community Forums

Share and learn in the Docker community.

Options to SSH Into Container on Remote Host Without Publishing Port?


(Bzowk) #1

Hey Guys -

I run Atomic Fedora 28 on a dedicated Docker system in my home lab which has about 20 containers currently. There are a couple of containers where I need to frequently copy files to/from yet the containers break if I try mounting the folder they write to as a volume on the host. It would be greatly beneficial if I were able to directly connect to these containers from my primary workstation (Windows 10.)

I’m sure that the following procedure would work in many cases…

1.Install open-ssh in the container
2.Publish port 22 to an open port on the host
3.Connect to “hostip:publishedport” using Putty / WinSCP / MobaXterm

…but am posting hoping there is a better solution out there that wouldn’t require all that mess. I found the app DockSSH which seems like it would do most of what I need, but cannot get it to work as I get
dial tcp [::1]:6379: getsockopt: connection refused
when I try to execute it to have it start hosting. :frowning:

Any suggestions? Thanks!


(Martin Terp) #2

you could maybe “connect” using:

docker exec -ti CONTAINER bash

or if its only for copying files to the container (from the host) you can use docker cp