stop
rfswift stop
Stop a running container without removing it.
Synopsis
rfswift stop -c CONTAINER_NAMEThe stop command gracefully stops a running container while preserving all data and state. The container can be restarted later with exec or using Docker commands.
Options
| Flag | Description | Required | Example |
|---|---|---|---|
-c, --container STRING |
Container name or ID to stop | Yes | -c my_container |
Examples
Basic Usage
Stop a specific container:
rfswift stop -c my_sdr_containerStop by container ID:
rfswift stop -c a1b2c3d4e5f6Stop with short container ID:
rfswift stop -c a1b2c3Real-World Scenarios
End of work day:
# Stop assessment container for the day
rfswift stop -c client_assessment
# Resume tomorrow
rfswift exec -c client_assessmentFree up resources:
# Stop idle containers to free memory
rfswift stop -c sdr_capture
rfswift stop -c wifi_analysis
rfswift stop -c bluetooth_scannerBefore system maintenance:
For now you can do the following trick:
# Stop all RF Swift containers before system update
for container in $(docker ps -q --filter "ancestor=penthertz/rfswift_noble"); do
rfswift stop -c $container
doneTemporary pause:
# Stop container during lunch break
rfswift stop -c long_running_capture
# Resume after lunch
rfswift exec -c long_running_captureWhat Happens When You Stop a Container
Data Persistence
When a container is stopped:
- β Container filesystem: All data inside the container is preserved
- β Mounted volumes: Data in mounted directories remains intact
- β Container configuration: All settings, bindings, and capabilities are preserved
- β Network configuration: Port bindings and network settings are saved
- β Running processes: All processes inside the container are terminated
- β Memory state: RAM contents are lost (not hibernated)
Example:
# Create container with captures
rfswift run -i sdr_full -n capture_session -b ~/captures:/root/captures
# Inside container: Start long capture
rfswift exec -c capture_session
rtl_sdr -f 100M -s 2.4M capture.dat &
exit
# Stop container
rfswift stop -c capture_session
# Process terminates, but files in ~/captures persist
# Resume later
rfswift exec -c capture_session
ls /root/captures # Files still thereProcess Handling
Graceful shutdown:
- Docker sends SIGTERM to all processes
- Processes have 10 seconds to clean up
- If processes don’t exit, Docker sends SIGKILL
- Container stops
Important for:
- Database containers (ensure data consistency)
- Long-running captures (may lose in-progress data)
- Network services (connections are dropped)
Container State After Stop
# Check container status
docker ps -a | grep my_container
# Output shows:
# STATUS: Exited (0) 2 minutes agoContainer is:
- β Still exists in Docker
- β Can be restarted
- β Can be committed to an image
- β Can be removed
- β Not consuming CPU
- β Not consuming RAM
- β Still consuming disk space
Stop vs Exit
| Operation | stop |
exit (from shell) |
|---|---|---|
| Initiated from | Host | Inside container |
| Stops container | β Always | β οΈ Sometimes* |
| Graceful shutdown | β Yes | β οΈ Depends |
| Use when | Managing from host | Done with current session |
Workflow comparison:
# Using exit (from inside container)
rfswift exec -c my_container
# ... work ...
exit
# Container may still be running if background processes exist
# Using stop (from host)
rfswift stop -c my_container
# Container definitely stops, all processes terminateCommon Workflows
Daily Work Cycle
# Monday: Create container
rfswift run -i pentest -n weekly_work -b ~/work:/root/work
# Monday-Friday: Use throughout week
rfswift exec -c weekly_work
# ... work ...
exit
# Each evening: Stop to free resources
rfswift stop -c weekly_work
# Each morning: Resume
rfswift exec -c weekly_work # Auto-starts
# Friday: Clean up when done
rfswift remove -c weekly_workResource Management
# List running containers
docker ps
# Stop idle containers
rfswift stop -c sdr_test1
rfswift stop -c old_assessment
rfswift stop -c experiment_containerContainer Lifecycle Management
# Week 1: Create and use
rfswift run -i sdr_full -n project_alpha
# Week 1-2: Use daily
rfswift exec -c project_alpha
# Weekend: Stop to save resources
rfswift stop -c project_alpha
# Week 3: Resume
rfswift exec -c project_alpha
# Project complete: Remove if not needed anymore
rfswift remove -c project_alphaBatch Container Management
# Stop multiple related containers
CONTAINERS="capture1 capture2 capture3"
for container in $CONTAINERS; do
echo "Stopping $container..."
rfswift stop -c $container
done
# Or using docker directly
docker stop capture1 capture2 capture3Troubleshooting
Container Already Stopped
Problem: Trying to stop an already stopped container
rfswift stop -c my_container
# Error: Container is not runningSolution:
# Check if running
docker ps | grep my_container
# If not in output, it's already stopped
docker ps -a | grep my_container
# No action neededContainer Not Found
Error: Error: No such container: container_name
Solutions:
# List all containers
rfswift las
# Container may have been removed
# Need to create new one
rfswift run -i image -n container_nameContainer Won’t Stop
Problem: Container doesn’t stop after reasonable time
Solutions:
# Wait longer (some containers need cleanup time)
rfswift stop -c my_container
# Wait 30-60 seconds
# Force stop with Docker
docker kill my_container # Immediate force stop
# Check what's preventing shutdown
docker logs my_containerMultiple Containers with Similar Names
Problem: Ambiguous container name
Solutions:
# Use full name
rfswift stop -c full_container_name
# Use container ID
docker ps # Get ID
rfswift stop -c a1b2c3d4e5f6
# List to identify
rfswift lastPermission Denied
Problem: Can’t stop container
Solutions:
# Use sudo on Linux (if not in docker group)
sudo rfswift stop -c my_container
# Or add user to docker group
sudo usermod -aG docker $USER
newgrp docker
# Then try again
rfswift stop -c my_containerData Loss Concerns
Problem: Worried about losing data when stopping
Verification:
# Check mounted volumes
docker inspect my_container | grep -A 10 Mounts
# Data in mounted volumes is safe
# Data in container filesystem is preserved when stopped
# Only running processes and RAM contents are lost
# To be extra safe, commit before stopping
rfswift commit -c my_container -i backup_image
rfswift stop -c my_containerRelated Commands
run- Create new containersexec- Enter and restart stopped containersremove- Permanently delete containerslast- List recent containers with statuscommit- Save container state before stopping
crontab -e then add 0 2 * * * /path/to/stop_idle_containers.sh