cd /news/developer-tools/keep-logged-in-to-claude-between-con… · home topics developer-tools article
[ARTICLE · art-91615] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Keep logged in to Claude between container builds

A developer shared a solution for keeping Claude and Continue AI assistant extensions logged in across devcontainer rebuilds when running as a non-root user. The fix involves mounting named volumes for configuration directories and using a postCreateCommand script with sudo chown to correct permissions, which persist across container rebuilds.

read1 min views1 publishedAug 11, 2026

This post is targeted devcontainer users not running the containers as root!

    "remoteUser": "root", # Not for you!

In the end, this is basically a post about mounting folders and ensuring the right folder permissions - when not running with root permissions or as the root user.

You probably have a setup looking something like this:

devcontainer.json

{
    "name": "Customer-Name - Dev machine - Debian",
    "dockerComposeFile": "docker-compose.yml",
    "service": "dev",
    "workspaceFolder": "/xyz",
    "remoteUser": "container-user", #This is the way!
    "mounts": [  
     "source=claude-${localWorkspaceFolderBasename},target=/home/container-user/.claude,type=volume",
     "source=continue-${localWorkspaceFolderBasename},target=/home/container-user/.continue,type=volume"
  ],
    "postCreateCommand": "bash ${containerWorkspaceFolder}/.devcontainer/debian/post-container-install.sh",

When you run a container as a non-root user (like container-user), you immediately run into a distinct permission trap—especially on macOS hosts.

When Docker creates named volumes (like the ones for .claude and .continue), it defaults to creating them as the root user. If your container-user tries to write configuration files or save chat history to these directories, they will be hit with a Permission denied error.

To fix this, we use the postCreateCommand to trigger a script that corrects the permissions from inside the container after the volumes are mounted.

Your post-container-install.sh

script should look like this:

#!/usr/bin/env bash

sudo chown -R container-user:container-user /home/container-user/.claude \
                                             /home/container-user/.continue 2>/dev/null || true

echo "Devcontainer setup complete!"

The sudo chown

command explicitly transfers ownership of the mounted volumes from root back to your non-root user. Because these are Docker named volumes rather than direct host bind mounts, the permission change persists across container rebuilds. This keeps your AI assistant extensions functioning correctly, ensuring your configuration and history remain intact and writable.

No more logging into Claude between builds!

Enjoy :)

── more in #developer-tools 4 stories · sorted by recency
── more on @claude 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/keep-logged-in-to-cl…] indexed:0 read:1min 2026-08-11 ·