-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Adds dev container and docs #1499
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
Conversation
Nice, I like this. |
m
Outdated
container_id=$(docker container inspect --format="{{.Id}}" $container_name 2>/dev/null) | ||
|
||
if [ $? -eq "0" ]; then | ||
echo "--- Killing $container_name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To kill an existing instance of the dev container. much better than having to exec bash
back into the container and kill all the watch processes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the watch process be running in the foreground? Then u can just ctrl+c
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not if you get detached from the container, which happens to me all the time. When my ssh loses connection for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you get detached, the container should exit. You'd want to pass in -it
for that to work.
m
Outdated
fi | ||
set -e | ||
|
||
echo "--- Spawning $container_name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the container is already running, we should just reuse it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I guess that wouldn't be very useful since you can just use the code-server terminal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to use the code-server terminal would not be optimal though considering it's constantly reloading, losing its history, etc.
bb95f7a
to
43b7d98
Compare
Anything preventing this from merging? @nhooyr |
ci/dev-image/exec.sh
Outdated
echo "--- Spawning $container_name" | ||
container_id=$(docker run \ | ||
-it \ | ||
--privileged \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does it need to be privileged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was considering vms when I added that. But you're right– not needed for now.
@@ -0,0 +1,46 @@ | |||
#!/usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a comment explaining what the script does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from documenting what the script does, looks solid to me. Nice work! 🚀
@@ -1,4 +1,6 @@ | |||
#!/usr/bin/env bash | |||
# exec.sh opens an interactive bash session inside of a docker container | |||
# for improved isolation during development |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate that it reuses the container if it exists? And starts it if stopped.
Closes #1498