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

Can't connect to local host after 1st time #100

Open
The-Michael-Chen opened this issue Jul 21, 2023 · 6 comments
Open

Can't connect to local host after 1st time #100

The-Michael-Chen opened this issue Jul 21, 2023 · 6 comments
Labels
Type: Question Further information is requested

Comments

@The-Michael-Chen
Copy link

The-Michael-Chen commented Jul 21, 2023

I was trying to run ros foxy on a docker container. It works fine launching it for the first time, but after I run docker stop container it doesn’t connect anymore to the localhost port. It still works in terminal, but doesn’t work with novnc in the browser.

The command I ran to initialize it was docker create -it -p 6080:80 -v $(pwd):/home/ubuntu/Desktop/yondu_ros --name ros2_gazebo --volumes-from ros2_practice tiryoh/ros2-desktop-vnc:foxy

I'm running it on MacOS Ventura 13.1

I’m not getting any errors except on the browser where it says “failed to connect to server”

@Tiryoh
Copy link
Owner

Tiryoh commented Jul 21, 2023

Hi @The-Michael-Chen,

Can you provide complete instructions to reproduce?
Is it possible that both the first container and the container that is launched with the docker create command are both trying to use port 6080 on the host machine?

@Tiryoh Tiryoh added the Type: Question Further information is requested label Jul 21, 2023
@The-Michael-Chen
Copy link
Author

The-Michael-Chen commented Jul 22, 2023

Hey @Tiryoh . Thank you so so much for offering to help! I make sure to close the container after opening so I don't think two containers are trying to use port 6080 on the host machine. The complete steps to reproduce are as follows:

docker create -it -p 6080:80 --name ros2_example tiryoh/ros2-desktop-vnc:foxy
It always works fine the first time.
(I've tried it without -it, without the binding, and without the volumes from and it still doesn't work)
docker stop ros2_example
docker start ros2_example
After that, it doesn't work with local host anymore. But, it still works while running in terminal.

Different things I've tried:

  1. I've tried checking for port conflicts. When I run lsof -i :6080 before restarting the container, nothing comes up. When running it during the container it only comes up with the correct port mapping. As I mentioned earlier I've also tried various ports.
  2. I've tried restarting my laptop and docker many times
  3. I've tried different browsers to ensure it wasn't an issue with cache
  4. I tried on my friends Mac and had the same issue. On my other friend's windows it worked fine.

@suzuki-takuo
Copy link

For your information, a friend of mine told me that logging out before stopping the container can avoid the problem. Thanks.

@The-Michael-Chen
Copy link
Author

@suzuki-takuo crazy enough that works! Why would that work lmao

@The-Michael-Chen
Copy link
Author

could we see this issue get resolved @Tiryoh

@Tiryoh
Copy link
Owner

Tiryoh commented Aug 7, 2023

@The-Michael-Chen Sorry, I've missed the notification
I'm glad to hear that the issue has been resolved!

@suzuki-takuo Thanks for your help!

Once I confirm that the issue and its solution can be reproduced, I'm planning to make an addition to the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants