rename
rfswift rename
Change a container’s name to a new identifier.
Synopsis
rfswift rename -n OLD_NAME -d NEW_NAMEThe rename command changes a container’s name without affecting its data, configuration, or state. This is useful for organizing containers, fixing naming mistakes, or adapting to new naming conventions.
Options
| Flag | Description | Required | Example |
|---|---|---|---|
-n, --name STRING |
Current container name | Yes | -n old_container |
-d, --destination STRING |
New container name | Yes | -d new_container |
Examples
Basic Usage
Simple rename:
rfswift rename -n old_container -d new_containerFix a typo:
rfswift rename -n sdr_containr -d sdr_containerMore descriptive name:
rfswift rename -n test -d sdr_spectrum_analysis_2024_01Real-World Scenarios
Add date to container name:
rfswift rename -n client_assessment -d client_assessment_2024_01_12Organize by project:
rfswift rename -n wifi_tools -d project_alpha_wifi_scannerChange naming convention:
# Old convention: type_number
rfswift rename -n sdr_1 -d rtlsdr_spectrum_analyzer
# New convention: purpose_date
rfswift rename -n test_container -d frequency_scan_2024_janClarify purpose:
rfswift rename -n container1 -d bluetooth_le_scanner_building_aStage-based naming:
# Development to production
rfswift rename -n api_server_dev -d api_server_prod
# Testing to staging
rfswift rename -n web_test -d web_stagingWhat Happens During Rename
What Changes
When you rename a container:
- ✅ Container name changes
- ✅ Container appears with new name in
rfswift lastanddocker ps - ✅ Docker internal references update
What Stays the Same
Everything else remains unchanged:
- ✅ Container ID (unchanged)
- ✅ All data inside container
- ✅ Mounted volumes and bindings
- ✅ Network configuration
- ✅ Port mappings
- ✅ Capabilities and cgroups
- ✅ Container state (running/stopped)
- ✅ Running processes (if container is running)
- ✅ Creation date and history
Example:
# Before rename
docker ps
# CONTAINER ID NAME IMAGE CREATED
# a1b2c3d4e5f6 old_name rfswift:sdr 2 hours ago
rfswift rename -n old_name -d new_name
# After rename
docker ps
# CONTAINER ID NAME IMAGE CREATED
# a1b2c3d4e5f6 new_name rfswift:sdr 2 hours ago
# Same ID, new name, same creation timeContainer State During Rename
The rename operation works on both:
- Running containers: Continue running without interruption
- Stopped containers: Remain stopped after rename
No downtime:
# Container is running
docker ps | grep web_server
# Rename while running
rfswift rename -n web_server -d api_backend
# Still running with new name
docker ps | grep api_backend
# Processes inside container are unaffectedTroubleshooting
New Name Already Exists
Error: Error: Conflict. The container name "..." is already in use
Solutions:
# Check existing containers
docker ps -a | grep new_name
# Option 1: Choose different name
rfswift rename -n old_name -d alternative_name
# Option 2: Remove/rename conflicting container first
rfswift rename -n new_name -d new_name_backup
rfswift rename -n old_name -d new_name
# Option 3: Remove conflicting container
rfswift remove -c new_name
rfswift rename -n old_name -d new_nameSource Container Not Found
Error: Error: No such container: old_name
Solutions:
# List all containers
rfswift lastInvalid Container Name
Error: Invalid container name
Common causes:
- Spaces in name
- Special characters (!@#$%^&*)
- Starting with hyphen
- Uppercase and symbols mixed
Solutions:
# Remove spaces
rfswift rename -n old -d my_new_container # Not "my new container"
# Remove special characters
rfswift rename -n old -d my_container # Not "my-container!"
# Don't start with hyphen
rfswift rename -n old -d my_container # Not "-my-container"
# Use lowercase and underscores
rfswift rename -n old -d my_sdr_container_2024Permission Denied
Error: Permission denied or Cannot connect to Docker daemon
Solutions:
# Use sudo on Linux
sudo rfswift rename -n old_name -d new_name
# Or add user to docker group
sudo usermod -aG docker $USER
newgrp docker
# Then try again
rfswift rename -n old_name -d new_nameRelated Commands
run- Create containers with proper names from the startlast- View container namesexec- Access containers by nameremove- Remove containerscommit- Save container state
{purpose}_{project}_{date} makes containers easy to identify and organize: sdr_analysis_alpha_2024_01