Skip to main content
Glama

docker_images

Perform Docker image operations including list, pull, push, remove, tag, inspect, prune, and history. Filter by dangling images or force remove images.

Instructions

Manage Docker images (list, pull, push, remove, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform on images
imageNoImage name or ID
tagNoTag for image operations
forceNoForce removal or operation
allNoApply to all images (for list/prune)
filterNoFilter results (e.g., "dangling=true")

Implementation Reference

  • Handler for docker_images tool - manages Docker images via CLI commands (list, pull, push, remove, tag, inspect, prune, history, save, load, import)
    async manageImages(args: DockerImageArgs): Promise<ToolResult> {
      const { action, image, tag, repository, file, filter, all, force, no_prune, dangling, until } = args;
      
      ValidationUtils.validateRequired({ action }, ['action']);
    
      let command = 'docker image';
    
      switch (action) {
        case 'list':
          command = 'docker images';
          if (all) command += ' -a';
          if (filter) command += ` --filter ${filter}`;
          if (dangling) command += ' --filter dangling=true';
          break;
          
        case 'remove':
          if (!image) throw new Error('Image name/ID is required for remove action');
          command = `docker rmi ${image}`;
          if (force) command += ' -f';
          if (no_prune) command += ' --no-prune';
          break;
          
        case 'pull':
          if (!image) throw new Error('Image name is required for pull action');
          command = `docker pull ${image}`;
          break;
          
        case 'push':
          if (!image) throw new Error('Image name is required for push action');
          command = `docker push ${image}`;
          break;
          
        case 'tag':
          if (!image || !tag) throw new Error('Both source image and target tag are required');
          command = `docker tag ${image} ${tag}`;
          break;
          
        case 'inspect':
          if (!image) throw new Error('Image name/ID is required for inspect action');
          command = `docker image inspect ${image}`;
          break;
          
        case 'prune':
          command = 'docker image prune';
          if (all) command += ' -a';
          if (force) command += ' -f';
          if (filter) command += ` --filter ${filter}`;
          if (until) command += ` --filter until=${until}`;
          break;
          
        case 'history':
          if (!image) throw new Error('Image name/ID is required for history action');
          command = `docker history ${image}`;
          break;
          
        case 'save':
          if (!image || !file) throw new Error('Image name and output file are required for save action');
          command = `docker save -o ${file} ${image}`;
          break;
          
        case 'load':
          if (!file) throw new Error('Input file is required for load action');
          command = `docker load -i ${file}`;
          break;
          
        case 'import':
          if (!file) throw new Error('Input file is required for import action');
          command = `docker import ${file}`;
          if (repository) command += ` ${repository}`;
          if (tag) command += `:${tag}`;
          break;
          
        default:
          throw new Error(`Unsupported image action: ${action}`);
      }
    
      try {
        const execTimeout = ['pull', 'push', 'save', 'load'].includes(action) ? this.pullTimeout : this.defaultTimeout;
        return await this.executeDockerCommand(command, { cwd: this.getCurrentWorkspace() }, execTimeout);
      } catch (error: any) {
        throw new Error(`Docker image ${action} failed: ${error.message}`);
      }
    }
  • TypeScript interface defining the input schema for docker_images tool arguments
    export interface DockerImageArgs {
      action: 'list' | 'remove' | 'pull' | 'push' | 'tag' | 'inspect' | 'build' | 'prune' | 'history' | 'save' | 'load' | 'import';
      image?: string;
      tag?: string;
      repository?: string;
      file?: string;
      filter?: string;
      all?: boolean;
      force?: boolean;
      no_prune?: boolean;
      dangling?: boolean;
      until?: string;
    }
  • src/index.ts:211-212 (registration)
    Registration of docker_images tool case handler dispatching to DockerService.manageImages()
    case 'docker_images':
      return await this.dockerService.manageImages(args as DockerImageArgs);
  • Tool definition/input schema registration for docker_images tool
    {
      name: 'docker_images',
      description: 'Manage Docker images (list, pull, push, remove, etc.)',
      inputSchema: {
        type: 'object',
        properties: {
          action: { 
            type: 'string', 
            enum: ['list', 'pull', 'push', 'remove', 'tag', 'inspect', 'prune', 'history'],
            description: 'Action to perform on images' 
          },
          image: { type: 'string', description: 'Image name or ID' },
          tag: { type: 'string', description: 'Tag for image operations' },
          force: { type: 'boolean', description: 'Force removal or operation' },
          all: { type: 'boolean', description: 'Apply to all images (for list/prune)' },
          filter: { type: 'string', description: 'Filter results (e.g., "dangling=true")' },
        },
        required: ['action'],
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; the description does not disclose behavioral traits such as destructiveness of prune/remove, authentication needs for push, or side effects. The burden falls on the description but it adds no safety or behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence is concise but overly brief; it mentions actions but no structure. Acceptable conciseness at the expense of completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and presence of destructive actions (prune, remove), the description should include safety warnings, output format hints, or usage examples. It is incomplete for adequate agent decision-making.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% so baseline 3 applies. The description repeats action names already in schema, adding no new semantics or clarification beyond the parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Manage Docker images (list, pull, push, remove, etc.)' clearly indicates the tool operates on Docker images with a variety of actions, distinguishing it from sibling tools like docker_containers or docker_build.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., docker_build for building, docker_run for containers). The description lacks context for appropriate selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agentics-ai/code-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server