Feature: add a /restart option
The current update mechanism doesn't work well when running Claude Code in a docker container. The software says "Update installed · Restart to apply", but restarting the entire container rolls back the update, and there seems to be no good way to restart the app within the container.
A /restart option would help as an interim solution.
As a side note, rebuilding the docker container doesn't update the software, because the "RUN npm install -g @anthropic-ai/claude-code" line is cached.
I haven't ran claude code in docker yet, but I usually /exit and claude again for a quick restart
+1 for the OP, I have exactly the same situation and I also looked for a "/restart" cmd
FWIW, I ended up modifyng the Dockerfile to include the exact version number of the npm package. That lets me rebuild the container and use the updated version.
Can you ctrl+c and restart? or is claude code literally your entrypoint in the docker container?
Yes, of course it is, this is how I run claude code interactively in a docker container:
d run -it -e CLAUDE_CONFIG_DIR=/home/node/.claude --volume ~/.config/claude-code:/home/node/.claude --volume .:/workspace jrychter/claude-code claude
This persists the settings/configuration.
I see the "Update installed · Restart to apply" message continuously in claude running in a terminal in vscode. There is no /restart command. I tried /exit and then started claude again, and the "Update installed · Restart to apply" message is there again. I checked /doctor and it says everything is healthy. I spent 30 minutes trying to figure out how to do this and no joy.
I see the "Update installed · Restart to apply" message continuously in claude running in a terminal in vscode. There is no /restart command. I tried /exit and then started claude again, and the "Update installed · Restart to apply" message is there again. I checked /doctor and it says everything is healthy. I spent 30 minutes trying to figure out how to do this and no joy.
I'm experiencing the same. Not sure how to apply the update aside from reinstalling everything.
In addition to suggestions above, some further workarounds when using claude-code in a container (eg the supplied devcontainer or your custom variant):
-
Rebuild the whole container, uncached, every time:
docker build --pull --no-cache -t claude-code .This will get you the latest of everything, but is a bit tedious to run several times per day. -
Uncache the installation of the claude-code npm package: Add a var in the dockerfile just prior to the npm install, eg:
ARG NOCACHE# Install ClaudeRUN npm install -g @anthropic-ai/claude-code
Then build the image using:
docker build --build-arg NOCACHE=$(date +%s%N) -t claude-code .
The image will be cached up to the point of the env var, and will be rebuilt from then onwards (eg the npm install will not be cached).
If you wrap this up in "claude-run.sh" bash, you can get the latest version of the npm package every time you run the claude-code container, with minimal build-delay.
Note, for a "/restart" option to work within a container, I expect it will have to not completely quit the npm package, as this will end the user container in most cases, so "/restart" is going to need be smarter than that (or maybe wrapped in bash which can handle "/quit" vs "/restart", via exit code?).
I got it to work by doing:
npm update -g @anthropic-ai/claude-code
I apparently had a pretty old version. I tried"
/exit, thenclaude- closing iTerm, re-opening,
claude - rebooting
after the npm update I see new commands, like /migrate-installer, and no more update message
If you used the /migrate-installer and are now running claude locally instead of from npm packages, I got the message to go away by doing claude update in terminal before running claude again
after /migrate-installer in Claude Code to switch from NPM to local installation...
claude update in terminal works great, thanks @briandonahue
Tried really hard to get claude code to restart itself. It seemed to think it could, but had to Ctrl+C.
https://github.com/user-attachments/assets/66663875-f7c0-4189-835c-9c65cc9ab680
@briandonahue thanks so much, claude update works well for the local one
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Hi - we've made many reliability improvements to the auto-upgrader so this should be less of an issue now. We've also switched users over to our native installer. Please open a new issue if you are still experiencing issues. Thank you!