Skip to main content

Container Management (Pods)

🔴 Experimental

The nanx pods command provides simplified container management, wrapping Docker and Docker Compose with a more intuitive interface.

Prerequisites

Before using pods commands, ensure you have:

  • Docker installed and running
  • Docker Compose (v2 or later recommended)
  • Proper permissions to run Docker commands

Quick Start

# List running containers
nanx pods ls

# Start a compose stack
nanx pods compose up

# Stop a compose stack
nanx pods compose down

Subcommands

ls

List all running containers:

nanx pods ls

Shows:

  • Container ID
  • Image name
  • Status (running, stopped, etc.)
  • Ports exposed
  • Container names

compose

Manage Docker Compose stacks:

# Start services in docker-compose.yml
nanx pods compose up

# Start in detached mode
nanx pods compose up -d

# Stop services
nanx pods compose down

# Stop and remove volumes
nanx pods compose down -v

# View logs
nanx pods compose logs

# Follow logs
nanx pods compose logs -f

Compose Options

Option Description
-d, --detach Run containers in background
-f <file> Specify compose file (default: docker-compose.yml)
-v, --volumes Remove volumes when stopping
--build Build images before starting

Common Workflows

Development Environment

# Start development stack
nanx pods compose up -d

# View logs from all services
nanx pods compose logs -f

# Stop when done
nanx pods compose down

Check Running Services

# List all containers
nanx pods ls

# Filter by project
docker ps --filter "label=com.docker.compose.project=myapp"

Restart Services

# Restart all services
nanx pods compose down && nanx pods compose up -d

# Rebuild and restart
nanx pods compose down && nanx pods compose up -d --build

Configuration

Pods commands automatically detect docker-compose.yml files in the current directory. You can also specify custom compose files:

# Use custom compose file
nanx pods compose -f docker-compose.dev.yml up

Examples

Basic Docker Compose File

version: '3.8'
services:
  web:
    image: nginx:alpine
    ports:
      - "8080:80"
    volumes:
      - ./html:/usr/share/nginx/html

  db:
    image: postgres:15
    environment:
      POSTGRES_PASSWORD: example
    volumes:
      - db-data:/var/lib/postgresql/data

volumes:
  db-data:

Using Pods Commands

# Start the stack
nanx pods compose up -d

# Check containers are running
nanx pods ls

# View logs from web service
nanx pods compose logs web

# Stop everything
nanx pods compose down

Troubleshooting

Docker Not Running

If you get connection errors:

# Check Docker is running
docker info

# Start Docker Desktop (macOS/Windows)
# or start Docker daemon (Linux)
sudo systemctl start docker

Permission Denied

On Linux, you may need to add your user to the docker group:

sudo usermod -aG docker $USER
# Log out and back in for changes to take effect

Port Already in Use

If ports are already bound:

# Find what's using the port
lsof -i :8080

# Stop conflicting containers
nanx pods ls
docker stop <container_id>

Known Limitations

  • Advanced Docker features may require direct Docker CLI usage
  • Some Docker Compose v1 commands may not be supported
  • Kubernetes/Podman support is planned but not yet implemented

Next Steps