When running colima in certain environments/terminals such as a new tmux session or when from a terminal opened by a configuration in VSCode tasks.json, it exits instantly after displaying successful startup messages. I initially came across this on VSCode (automating tasks to run colima on folder open) and also isolated it in tmux.
I have tried messing around with the interactive and login flags with /bin/zsh (I use starship.rs) but this doesn't seem to be the issue. It seems like its something to do with the isolation of the terminal (in tmux, the command has finished running, so it quits), but colima runs as a background process so I don't understand why colima also exits.
What causes my issue, and how can I prevent this from happening?
- OS: MacOS Monterey 12.6.8
- Colima: 0.5.5
- VSCode: 1.81.1
- tmux: 3.3a_2
Tmux
I've tried using tmux new-session -d -s colima 'colima start'
and /bin/zsh -c "tmux new-session -d -s colima 'colima start'"
, giving the same result (below).
Edit: tmux new-session -d -s colima 'colima start; sleep 10'
also keeps the colima instance running for 10 seconds and no more.
VSCode tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
// this doesn't persist
{
"label": "Start colima",
"type": "shell",
"command": "colima",
"args": ["start"],
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
// in workspace settings.json
"terminal.integrated.automationProfile.osx": {
"path": "/bin/zsh",
"args": ["-il"]
}
Result
colima starts successful but doesn't persist (exits instantly after). The tmux session exits instantly after INFO[0049] done
is shown. The VSCode integrated task terminal shows the following:
INFO[0000] runtime: docker
INFO[0000] preparing network ... context=vm
INFO[0001] starting ... context=vm
INFO[0042] provisioning ... context=docker
INFO[0042] starting ... context=docker
INFO[0049] done
* Terminal will be reused by tasks, press any key to close it.
Running colima status anywhere afterwards gives FATA[0000] colima is not running
.
Edit: In tasks.json, using "command": "colima start; sleep 0"
keeps the colima instance running indefinitely. colima start; echo hello
also works. I know you're supposed to use args, but I'm not sure how to do that with multiple commands.
However, when I run a make command ("command": "make run-colima"
) which consists of colima start
and docker-compose up -d
, colima exits instantly again, unless I do the same thing: "command": "make run-colima; sleep 0
.
This allows me to solve my problem, but seems really strange, and I have no explanation for it.