r/docker•
cquick97

docker gitlab-ce ssh problems

Hey guys,

I am having a weird problem with this container. I know it is specific to gitlab so I'm not sure how much experience you might have with that, but I don't know if it is a problem with a docker config file or what.

So, I have a gitlab-ce container, and I am trying to be able to connect via SSH (to push and pull to repos). I have port 2222 on my host machine mapped to port 22 on the container. I've logged into the container while it was running and verified that the sshd daemon was running, as well as permissions to .ssh/authorized_hosts and related files. Everything should be working fine. But, when I try to login from my desktop, to git@ip:2222, it gives me the error Connection reset by <IP>.

Weird part is, I can connect just fine if I try to SSH from the docker host into the container. This works with the container's local IP, the host machine's domain name, and the host machine's public IP.

This is running on an AWS instance, so I have verified that the security-group allows for port 2222, and I have also completely flushed iptables so there are no ports being blocked by the host.

WEIRDER PART :) When I am on my desktop, and I run nc <IP> 2222, what do I get? Oh yes, SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 and nice SSH banner. So, my desktop can definitely see the sshd service running inside the container!

I am just completely baffled by this, and I've been trying various stuff around the internet all day and I am really hoping someone here can point me in the right direction. :)

If you need me to post any configuration files or logs, let me know and I'll add them!

Thanks in advance!

Posted Sep 12, 2016, 2:18 AM UTC

35
kevinsimper•

Hi cquick97, i am just answering here :)

I would look at the sshd logs very quickly to see what it says: http://serverfault.com/questions/130482/how-to-check-sshd-log

After that I would try to install it normally following the guidelines and if that works then try it again in docker, because docker does often not help if you have a problem because of the added layer!

2
cquick97OP•

Thanks a ton for taking the time to respond.

Embarrassingly enough, I found out that it was actually my campus network blocking the connection... VPN to my home and it works fine. I guess I didn't really check since I was able to see the SSH banner with netcat (still don't know why that works, but oh well).

So yeah, it is working now. Thanks! :)

2
kevinsimper•

Glad to hear that you got it working! :) It is annoying when your connection is altered by somebody else.

1
valentin2105•

Have you try this in ur gitlab.rb config file ? gitlab_rails['gitlab_ssh_host'] = 'example.com:2222'

1
cquick97OP•

I had it already set to 'example.com', but I changed it to 'example.com:2222' and it didn't fix it unfortunately. Thanks though!

1