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

[BUG]: Remote Desktop Problem #9

Closed
yilmazabdurrah opened this issue Nov 20, 2024 · 9 comments
Closed

[BUG]: Remote Desktop Problem #9

yilmazabdurrah opened this issue Nov 20, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@yilmazabdurrah
Copy link
Member

Description of the bug

When you first build the container, the remote desktop works well. However, when you restart the PC and reopen the container remote desktop doesn't work unless you rebuild the container or delete the container itself before opening.

Steps To Reproduce

  1. Create repo using template and build in container using VScode
  2. Check remote desktop if it works (should work)
  3. Restrart the PC, try to reopen container
  4. Check remote desktop whether it works (should have connection problem)

Additional Information

No response

@yilmazabdurrah yilmazabdurrah added the bug Something isn't working label Nov 20, 2024
@gcielniak
Copy link

gcielniak commented Nov 20, 2024

This is similar (although not the same) under Windows OS. The remote desktop only works with the first launch of the container but then (after re-starting the container) it refuses the connection. The steps to remedy are the same as above: rebuild or delete the container. Could it be some issues with port allocation between the host and the container? Btw. it seems that this particular issue does not affect the installations on PCs with the POP OS.

Steps To Reproduce

  1. Build and run the container using VSCode under WinOS
  2. Check the remote desktop
  3. Close the remote connection and restart the container.
  4. Use the remote desktop (should fail).

@yilmazabdurrah
Copy link
Member Author

And one more comment that may help, the current configuration that @ibrahimhroob uses for aoc_fruit_detector doesn't have this issue.

@marc-hanheide
Copy link
Member

This is not a bug, but a feature ;-)

devcontainers are not deleted but stopped when a VSCode session ends. When one reconnects, the existing container is just started again. So, one solution is to change

"postCreateCommand": "/opt/entrypoint.sh /bin/true; .devcontainer/post-create.sh",

to use postStartCommand instead of postCreateCommand to start a fresh virtual desktop. That's worth trying.

The other option, as discussed in microsoft/vscode-remote-release#3512 could be to add

"runArgs": [
    "--rm"
  ],

to the devcontainer.json. This ensures that the container is not just stops, but is also deleted, so everytime one reconnects it is fresh. But it also means that after a 10 second disconnect, the container is gone, as are any running processes.

@gcielniak
Copy link

Thanks Marc, I will try this on Windows and report back.

@gcielniak
Copy link

using postStartCommand works on Windows, thanks @marc-hanheide! I'll wait for @yilmazabdurrah to confirm if that fixes the original issue too.

@yilmazabdurrah
Copy link
Member Author

using postStartCommand also works in Ubuntu.

@marc-hanheide
Copy link
Member

Cool, who does the honours of opening a PR to fix this issue?

@marc-hanheide
Copy link
Member

pinging @ibrahimhroob to consider adopting this in derived repositories like the AOC ones.

@marc-hanheide
Copy link
Member

closed by #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants