-
Notifications
You must be signed in to change notification settings - Fork 310
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
Option to restart development container #2906
Comments
If you know the container id you can always restart the container. I tried it but VSCode lost connection anyway. I suppose you want to reuse your container. I already asked to keep PID file of the development container at the client side as a feature. Please vote for it. |
@ramblingenzyme you can restart service using docker-compose restart-service but I don't expect a different result. because of a lack of wait-for-reconnect at the client side. When container will be restarted forcibly it will be the same too. |
@ramblingenzyme |
Hi @PavelSosin-320, I had issues with restarting the container outside of VSCode, but it could just be me. I don't want to reuse a running container, I want to restart the container without rebuilding and have all the remote VSCode stuff spin up, which doesn't seem to happen but I can try again. The other issue is when I tell VSCode to rebuild while the container is running, it doesn't wait for the container to stop before rebuilding and fails, so it has nothing to do with waiting for the container to start running. |
This was a pain point for me too, though on top of container restarts I also sometimes want the container to persist beyond the vscode session. I've come to the conclusion that if sometimes I want stop the container but not vscode, and sometimes I want to stop vscode but not the container... then I probably shouldn't be managing it with vscode. I've since swapped to managing the container with a command-line script and vscode'ing in with 'attach to running container'. My management script looks like this: #!/bin/bash
export DOCKER_HOST="ssh://[email protected]"
case $1 in
code )
uri=$(python -c "import json; desc = json.dumps({'containerName': '/drones', 'settings': {'host':'ssh://aj-server.local'}}); print(f'vscode-remote://attached-container+{desc.encode().hex()}/code')")
code --folder-uri "$uri" ;;
build )
docker build docker -t drones ;;
run )
docker run -td --name drones -v /home/ajones/code/drones:/code drones:latest ;;
logs )
docker logs drones ;;
stop )
docker stop drones ;;
start )
docker start drones ;;
restart )
docker restart drones ;;
rm )
docker rm drones ;;
* )
echo "No command matching '$1'"
esac It's saved as While my situation is a bit different from yours @ramblingenzyme , I haven't had trouble with vscode reinstalling itself after a restart. After (It'd be even better if vscode auto-reconnected, but this behaviour suffices) |
Haven't had any issues with the Compose stack pulling itself down after closing VSCode, not sure what's special about our config. I need to mess with it again, but I had set "restart: always" and stopped the container from VSCode, which might be the issue. I'll see if pressing restart in the Docker for Mac GUI will work but even if that works, it would be nice to do it from inside VSCode to make the process consistent no matter what OS you're running on. |
@ramblingenzyme The ssh-agent connection should be reestablished when you reload the window. Could you try |
@chrmarti Will do, but I remember it not working. Today I found things work okay if I don't set a restart policy for the container and restart the dev container using the normal Docker extension. |
Hey @chrmarti, this issue might need further attention. @ramblingenzyme, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
@ramblingenzyme Have you had a chance to try reloading the window to reestablish the ssh-agent connection? Is that the ssh-agent on the host or the container? |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
We've been using a Docker Compose stack as a standardised development environment internally at Easy Agile and it's been great for the most part.
I've pretty regularly run into an issue where my ssh-agent connection fails and the only reasonable solution is to rebuild the container. This not only takes time and does way too much, VSCode doesn't wait for the running container to quit before trying to build and fails.
If we could get an option to restart a development container without rebuilding the container, this would smooth over a real pain point.
The text was updated successfully, but these errors were encountered: