Skip to content
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

Failed to open TCP connection to localhost:35729 (Cannot assign requested address - connect(2) for "localhost" port 35729) #340

Closed
kdiogenes opened this issue Sep 2, 2017 · 2 comments

Comments

@kdiogenes
Copy link

This error happen after starting the server, inside a docker container, and trying to access it in localhost:3333

This error is already reported in some projects puma/puma#1022 and has some hints here and there https://stackoverflow.com/a/45899937/977201

I was able to "fix" it by adding the option host: '127.0.0.1' to https://github.com/locomotivecms/wagon/blob/master/lib/locomotive/wagon/commands/serve_command.rb#L84

I think that the final fix must live in rack-livereload, but I didn't have the time to understand the solution in other projects, so I don't understand where it must live in rack-liverload. For the meantime, I'm opening this issue to help other and also get help.

@jfturcot
Copy link

If anyone else runs into that error when running wagon serve in the current Ruby Docker image (ruby:2.4.2), the solution is within the Stack Overflow post that @cerdiogenes posted here: https://stackoverflow.com/a/45899937/977201

You have to modify /etc/hosts and remove localhost from the ipv6 line.

From ::1 localhost ip6-localhost ip6-loopback to ::1 ip6-localhost ip6-loopback

Here is how I do it using sed:

cp /etc/hosts /etc/hosts.new && \
sed -i 's/::1\tlocalhost ip6-localhost ip6-loopback/::1 ip6-localhost ip6-loopback/' /etc/hosts.new && \
cp -f /etc/hosts.new /etc/hosts

I hope that this will help someone else.

@sebastienbeau
Copy link
Contributor

Thanks for the tips, I have fixed my image that I use for wagon with that patch : akretion/docky-ruby@f4698d7

@did did closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants