Docker Container SSH Denied

Linode Staff

I have a service that connects clients to a service running on a Docker container on my instance over port 3122 but something is amiss as the clients are not connecting properly.

The container has a map for 0.0.0.0:3122->22/tcp and when I run ss I see a tcp listen on 3122 to 'docker-proxy', but when I attempt to ssh to 3122 I receive a "Permission denied (publickey)" error.

I did follow your hardening instructions for the Ubuntu host and disabled ssh password authentication:

https://www.linode.com/docs/security/securing-your-server

I assumed this would not be an issue b/c 3122 is pointing to the container, not the host.

1 Reply

It is likely that the your sshd.config is applying your configuration to your container as well.

Here are some helpful resources from Docker on container networking to help you accomplish this:

https://docs.docker.com/config/containers/container-networking/
https://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/
https://docs.docker.com/engine/examples/running_ssh_service/#run-a-test_sshd-container

We hope that helps point you in the right direction.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct