A minimal, persistent Docker container for Solana development on Ubuntu 25.10.
- ✅ Ubuntu 25.10 base image pinned to a digest
- ✅ Persistent workspace stored in Docker volume (defaults to
solana-workspace) - ✅ Auto-restart on failure
- ✅ Starts on system boot
- ✅ Data survives container deletion
- ✅ Minimal setup - students install Solana tools themselves
- ✅ Resource limits and logging configured via
docker-compose.yml
- Ubuntu 25.10 VPS or local machine
- Docker and Docker Compose installed
Note on Docker Installation: Ubuntu 25.10 is a very new release, and Docker's official repository doesn't yet have packages specifically for it. The installation instructions below use the Ubuntu 24.04 LTS (noble) repository, which is fully compatible with Ubuntu 25.10. This is a safe and recommended workaround until Docker adds official support for Ubuntu 25.10.
# Add Docker's official GPG key
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources
# Note: Using 'noble' (Ubuntu 24.04 LTS) repository as Docker doesn't yet support Ubuntu 25.10
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
noble stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Add your user to docker group (to run without sudo)
sudo usermod -aG docker $USER
# Log out and back in for group changes to take effectVerify Docker installation:
docker --version
docker compose versiongit clone <your-repo-url>
cd solana-dev-dockercp env.example .env
nano .env # or your editor of choiceKey values:
SOLANA_VOLUME_NAME: Docker volume name for persistent workspace (defaults tosolana-workspace).SOLANA_DEV_MEMORY/SOLANA_DEV_CPUS: optional Docker resource limits.SOLANA_CLUSTER/SOLANA_RPC_URL: Solana network defaults inside the container.
chmod +x scripts/*.sh./scripts/setup.shThis will:
- Create the Docker volume for persistent workspace storage
- Build/pull the pinned Ubuntu 25.10 image
- Start the container with auto-restart enabled
docker compose exec solana-dev bashYou should now be inside the container as the solana user.
Inside the container, run:
curl --proto '=https' --tlsv1.2 -sSfL https://solana-install.solana.workers.dev | bashRef: https://solana.com/docs/intro/installation
Reload your shell configuration:
source ~/.bashrcNote: The container is configured to automatically add the Solana CLI to your PATH in ~/.bashrc when the Solana tools are installed. After installing Solana tools, simply run source ~/.bashrc (or exit and re-enter the container) and the Solana CLI will be available.
Verify installation:
rustc --version
solana --version
anchor --version
node --version
yarn --versionYour workspace is at /home/solana inside the container, stored in a Docker volume that persists across container restarts.
# Create a new project
mkdir my-solana-project
cd my-solana-project
# Your work is automatically persisted in the Docker volumeFrom within the repository directory:
docker compose exec solana-dev bashFrom anywhere on your system:
docker exec -it solana-dev-container bashFor convenience, add an alias to access the container from anywhere:
echo 'alias solana-dev="docker exec -it solana-dev-container bash"' >> ~/.bashrc
source ~/.bashrcThen you can simply run solana-dev from any directory.
docker compose up -ddocker compose downdocker compose restartdocker compose logs -fdocker compose psYour workspace is stored in a Docker volume, which persists data even if the container is deleted. The volume is mounted at /home/solana inside the container.
Files are at /home/solana:
docker compose exec solana-dev bash
cd /home/solana
ls -laTo access files from the host, you can copy them from the volume:
# Copy a file from the volume to your host
docker compose exec solana-dev cat /home/solana/my-file.rs > ~/my-file.rs
# Or use docker cp
docker cp solana-dev-container:/home/solana/my-file.rs ~/my-file.rs
# View volume location and details
docker volume inspect solana-workspaceAlternatively, you can mount the volume temporarily to access files directly:
# Create a temporary container to access volume files
docker run --rm -v solana-workspace:/workspace ubuntu:25.10 ls -la /workspace./scripts/backup.shThis script reads .env, snapshots everything in the Docker volume, and drops the archive under backups/ inside the repo:
backups/solana-workspace-backup-20241118_143022.tar.gz
ls -lh backups/./scripts/restore.sh backups/solana-workspace-backup-YYYYMMDD_HHMMSS.tar.gzAdd to crontab for daily backups:
crontab -eAdd this line (backs up daily at 2 AM):
0 2 * * * cd /path/to/solana-dev-docker && ./scripts/backup.sh
If you modify docker-compose.yml:
docker compose down
docker compose up -d --force-recreatedocker compose downYour data in the Docker volume is preserved.
docker compose down -vThis removes both the container and the associated volume. All data will be lost.
docker stats solana-dev-containerdocker compose exec solana-dev solana --version
docker compose exec solana-dev ls -la /home/solanaCheck logs:
docker compose logsCheck if port conflicts exist:
docker compose psFix permissions inside container:
docker compose exec solana-dev bash
sudo chown -R solana:solana /home/solanaEnsure Docker is running:
sudo systemctl status docker
sudo systemctl start dockerAdd your user to docker group:
sudo usermod -aG docker $USER
# Log out and back inCheck logs for errors:
docker compose logs --tail=50Reload shell configuration:
source ~/.bashrcOr exit and re-enter the container:
exit
docker compose exec solana-dev bashCheck Docker disk usage:
docker system dfClean up unused Docker resources:
docker system prune -aTo completely remove everything (container, volume, image, network) and start fresh:
./scripts/destroy.shThis script will:
- Stop and remove the container
- Remove the Docker volume (
⚠️ ALL YOUR WORK WILL BE LOST!) - Remove the Docker image
- Remove the Docker network
Warning: This permanently deletes all data in the volume. Make sure you've backed up anything important with ./scripts/backup.sh first.
The script requires you to type yes to confirm before proceeding.
Alternatively, you can do it manually:
# Stop and remove container and volume
docker compose down -v
# Remove Docker image
docker rmi ubuntu:25.10
# Start fresh
./scripts/setup.sh# Create a test file
docker compose exec solana-dev bash -c "echo 'test' > /home/solana/test.txt"
# Stop container
docker compose down
# Start container
docker compose up -d
# Check file still exists
docker compose exec solana-dev cat /home/solana/test.txt
# Should output: test# Create file in container
docker compose exec solana-dev bash -c "echo 'from container' > /home/solana/volume-test.txt"
# Stop and remove container (but keep volume)
docker compose down
# Start container again
docker compose up -d
# Check file still exists in volume
docker compose exec solana-dev cat /home/solana/volume-test.txt
# Should output: from container# Kill the container process
docker kill solana-dev-container
# Wait a few seconds, then check status
docker compose ps
# Should show container running againInside container:
docker compose exec solana-dev bash
# Test Solana CLI
solana --version
# Test Anchor
anchor --version
# Test Rust
rustc --version
# Create a test Solana keypair
solana-keygen new --no-bip39-passphrase -o ~/test-keypair.json
# Check balance (should be 0)
solana balance ~/test-keypair.jsonCopy the example environment file:
cp env.example .envEdit .env to customize defaults for all students. Example:
SOLANA_VOLUME_NAME=solana-workspace
SOLANA_DEV_MEMORY=4g
SOLANA_DEV_CPUS=2.0
SOLANA_CLUSTER=devnet
# SOLANA_RPC_URL=https://api.devnet.solana.comEdit docker-compose.yml and add:
ports:
- "8899:8899" # RPC
- "8900:8900" # WebSocketThen restart:
docker compose down
docker compose up -dEdit docker-compose.yml:
container_name: my-custom-nameAdjust SOLANA_DEV_MEMORY and SOLANA_DEV_CPUS in .env, then rerun:
docker compose down
docker compose up -d --force-recreate-
Never commit keypairs to git
- The
.gitignorealready excludessolana-workspace/
- The
-
Use devnet for testing
solana config set --url devnet -
Backup your keypairs separately
docker compose exec solana-dev bash -c "cp /home/solana/*.json /tmp/" && docker cp solana-dev-container:/tmp/ ~/keypair-backup/
-
Keep Docker updated
sudo apt-get update sudo apt-get upgrade docker-ce docker-ce-cli containerd.io
Inside the container:
# Update Solana CLI
solana-install update
# Update Anchor
cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked --force
# Update Rust
rustup updatedocker compose down# Stop and remove container and volume
docker compose down -v
# Remove Docker image
docker rmi ubuntu:25.10
# Remove repository
cd ..
rm -rf solana-dev-dockerQ: Where is my data stored?
A: In a Docker volume (default name: solana-workspace), mounted at /home/solana inside the container. Use docker volume inspect solana-workspace to see the physical location on your host.
Q: Will my data survive if I delete the container?
A: Yes! Data in the Docker volume persists even after docker compose down. The volume is only removed if you use docker compose down -v.
Q: Can I use VS Code with this setup?
A: Yes! Use VS Code Remote-Containers extension to work directly inside the container, or copy files to/from the volume as needed.
Q: How do I update the container?
A: docker compose down && docker compose up -d --force-recreate
Q: Can multiple people use this setup?
A: Yes! Each user can create their own volume by setting SOLANA_VOLUME_NAME in their .env file.
Q: Does this work on Mac/Windows?
A: This is optimized for Ubuntu 25.10. For Mac/Windows, use Docker Desktop and adjust paths.
This repository includes a custom Docker-colored VS Code theme that automatically applies when you open the workspace. The theme features:
- Docker Blue (
#0db7ed) accents throughout the interface - Dark background optimized for extended coding sessions
- Syntax highlighting with Docker-themed colors for keywords, functions, and types
- Customized UI elements including status bar, activity bar, and tabs in Docker colors
The theme is configured in .vscode/settings.json and will be automatically applied when you open this workspace in VS Code. No additional installation or configuration is required.
If you prefer to use a different theme, you can override it in your user settings or modify .vscode/settings.json.
Issues and pull requests welcome!
MIT
Happy Building on Solana! 🚀