-
Notifications
You must be signed in to change notification settings - Fork 69
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
Accessing forwarded port from Docker container #14
Comments
Thanks for reaching out! Could you please provide below information to investigate this issue further?
|
I am seeing the same problem that @maxispeicher raised in this issue.
|
Sorry for the late reply, but I kind of managed to "fix" it. However, the solution is not optimal. After changing the line |
also struggling with that problem but I am afraid to correct that /etc/hosts because I have some other software on that particular container on which I am using SSM how about just making configurable also that session-manager-plugin/src/sessionmanagerplugin/session/portsession/basicportforwarding.go Line 153 in c523002
to be able to put there |
Hopefully the PR that fixes this will be merged soon, but in the meantime, if you're (rightfully) avoiding modifying /etc/hosts you could also use socat. If you have an ECS Task listening on port 8000, and want to connect to that from your host machine on port 8000, via a Docker-run SSM port forwarding session, it looks something like this: docker (compose) run -p 8000:8000 [...] socat TCP-LISTEN:8000,fork,reuseaddr TCP:127.0.0.1:8081 & aws ssm start-session [...] --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["8000"],"localPortNumber":["8001"]}' where [...] is your image that has the AWS CLI, SSM Plugin, and socat installed, AWS region/profile/target, etc. |
yes I have used |
Any insight on when this will be fixed? |
Any updates on the fix? :) |
I don't know if this is related, but this works for me. docker run -it --rm \
-e "PGPASSWORD=${DB_PASSWORD}" \
postgres:16.3 psql -h host.docker.internal -p 5432 -U foo -d bar The key is to specify |
I have begun work on a PR for this. If anyone that has worked on this plugin can give me a jump start on understanding the networking aspect of the plugin, that would help. Without delving too much into the big picture, I made a first pass attempt to get it working simply by overriding the hostname for the listener. See change. The listener listens on the specified interface, port. I'll add more info later with details of what I'm encountering. I'm hoping to make initial contact with a maintainer at this point. |
If you've tried the solutions mentioned above without success, here's another approach that worked for me:
Note: Changing For more information on this approach, see this StackOverflow post. Hopefully, this helps someone facing a similar issue! |
I'm running through the same problem here! It's painful to use a non-oficial solution just to get around that... Any updates on this?? This would be a major and important feature |
Hello,
I am using the
PortForwardingSession
to access some services in our AWS account. When using it locally everything works fine and I have access vialocalhost:<port>
. However, inside a docker container I'm not able to access the same port. At the same time I am able to access a different port with a local web server without any issues. So the problem only seems to exist in combination of SSM and Docker.When using
nmap
from inside the container it also shows the port used for the forwarding session as closed.running on Ubuntu 20.04.3 LTS
Do you know any reason why the SSM port behaves differently in comparison to e.g. a webserver.
Many Thanks!
The text was updated successfully, but these errors were encountered: