rfswift container rename
Rename a container.
rfswift container rename gives a container a new name. Its data, settings and state don’t change, and a running container keeps running. Use it to fix a typo or to name containers more clearly.
rfswift container rename -n old_container -d new_containerOther spellings: the legacy form rfswift rename still works and prints a notice. The flags are the same. See the command tree.
Synopsis
rfswift container rename -n OLD_NAME -d NEW_NAMEOptions
| Flag | Description | Required | Example |
|---|---|---|---|
-n, --name STRING |
Current container name | Yes | -n old_container |
-d, --destination STRING |
New container name | Yes | -d new_container |
Container picker: without -n in an interactive terminal, RF Swift shows a picker so you can choose the container to rename.
Examples
Basic usage
Simple rename
rfswift container rename -n old_container -d new_containerFix a typo
rfswift container rename -n sdr_containr -d sdr_containerMore descriptive name
rfswift container rename -n test -d sdr_spectrum_analysis_2024_01Everyday cases
Add date to container name
rfswift container rename -n client_assessment -d client_assessment_2024_01_12Organize by project
rfswift container rename -n wifi_tools -d project_alpha_wifi_scannerChange naming convention
# Old convention: type_number
rfswift container rename -n sdr_1 -d rtlsdr_spectrum_analyzer
# New convention: purpose_date
rfswift container rename -n test_container -d frequency_scan_2024_janClarify purpose
rfswift container rename -n container1 -d bluetooth_le_scanner_building_aStage-based naming
# Development to production
rfswift container rename -n api_server_dev -d api_server_prod
# Testing to staging
rfswift container rename -n web_test -d web_stagingWhat happens during rename
What changes
Only the name changes: the container appears under its new name in rfswift container last and docker ps, and the engine’s internal references are updated.
What stays the same
Everything else stays as it was: the container ID, the data inside it, mounted folders and bindings, network settings and port mappings, capabilities and cgroup rules, its state (running or stopped), the processes running in it, and its creation date and history.
Example
# Before rename
docker ps
# CONTAINER ID NAME IMAGE CREATED
# a1b2c3d4e5f6 old_name rfswift:sdr 2 hours ago
rfswift container 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
You can rename a container whether it is running or stopped. A running container keeps running without interruption; a stopped one stays stopped.
No downtime
# Container is running
docker ps | grep web_server
# Rename while running
rfswift container 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
The error message is: Error: Conflict. The container name "..." is already in use
To fix it:
# Check existing containers
docker ps -a | grep new_name
# Option 1: Choose different name
rfswift container rename -n old_name -d alternative_name
# Option 2: Remove/rename conflicting container first
rfswift container rename -n new_name -d new_name_backup
rfswift container rename -n old_name -d new_name
# Option 3: Remove conflicting container
rfswift container rm -c new_name
rfswift container rename -n old_name -d new_nameSource container not found
The error message is: Error: No such container: old_name
To fix it:
# List all containers
rfswift container lastInvalid container name
The error message is: Invalid container name
Common causes: a space in the name, special characters such as !@#$%^&*, or a name that starts with a hyphen.
To fix it:
# Remove spaces
rfswift container rename -n old -d my_new_container # Not "my new container"
# Remove special characters
rfswift container rename -n old -d my_container # Not "my-container!"
# Don't start with hyphen
rfswift container rename -n old -d my_container # Not "-my-container"
# Use lowercase and underscores
rfswift container rename -n old -d my_sdr_container_2024Permission denied
The error message is: Permission denied or Cannot connect to Docker daemon
On Linux, your user can’t talk to Docker yet. Give it access once (no logout needed), then try again:
rfswift host docker-access
rfswift container rename -n old_name -d new_nameOr, by hand:
sudo usermod -aG docker $USER
newgrp docker
rfswift container rename -n old_name -d new_nameRelated commands
container create: create containers with clear names from the startcontainer last: see container namescontainer shell: enter a container by namecontainer rm: remove a containercontainer commit: save a container’s state
Naming tip: pick one naming pattern and stick to it, for example {purpose}_{project}_{date}: sdr_analysis_alpha_2024_01.
Update anything that uses the old name: scripts, monitoring or other containers that refer to the container by name need the new name too.