ruby_llm-docker 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/docker_chat.rb +41 -0
- data/lib/ruby_llm/docker/build_image.rb +64 -65
- data/lib/ruby_llm/docker/copy_to_container.rb +89 -134
- data/lib/ruby_llm/docker/create_container.rb +64 -86
- data/lib/ruby_llm/docker/create_network.rb +63 -79
- data/lib/ruby_llm/docker/create_volume.rb +57 -79
- data/lib/ruby_llm/docker/exec_container.rb +94 -111
- data/lib/ruby_llm/docker/fetch_container_logs.rb +63 -85
- data/lib/ruby_llm/docker/list_containers.rb +46 -40
- data/lib/ruby_llm/docker/list_images.rb +34 -55
- data/lib/ruby_llm/docker/list_networks.rb +35 -57
- data/lib/ruby_llm/docker/list_volumes.rb +35 -64
- data/lib/ruby_llm/docker/pull_image.rb +24 -48
- data/lib/ruby_llm/docker/push_image.rb +60 -89
- data/lib/ruby_llm/docker/recreate_container.rb +47 -79
- data/lib/ruby_llm/docker/remove_container.rb +48 -76
- data/lib/ruby_llm/docker/remove_image.rb +53 -95
- data/lib/ruby_llm/docker/remove_network.rb +42 -78
- data/lib/ruby_llm/docker/remove_volume.rb +52 -85
- data/lib/ruby_llm/docker/run_container.rb +73 -53
- data/lib/ruby_llm/docker/start_container.rb +35 -58
- data/lib/ruby_llm/docker/stop_container.rb +40 -66
- data/lib/ruby_llm/docker/tag_image.rb +67 -95
- data/lib/ruby_llm/docker/version.rb +10 -1
- data/lib/ruby_llm/docker.rb +13 -0
- metadata +15 -1
|
@@ -2,113 +2,79 @@
|
|
|
2
2
|
|
|
3
3
|
module RubyLLM
|
|
4
4
|
module Docker
|
|
5
|
-
#
|
|
5
|
+
# MCP tool for recreating Docker containers.
|
|
6
6
|
#
|
|
7
|
-
# This tool provides a
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
7
|
+
# This tool provides a complete container recreation process that stops
|
|
8
|
+
# the existing container, removes it, and creates a new container with
|
|
9
|
+
# the same configuration. This is useful for applying image updates,
|
|
10
|
+
# clearing container state, or resolving container corruption issues.
|
|
11
11
|
#
|
|
12
12
|
# == Features
|
|
13
13
|
#
|
|
14
|
-
# -
|
|
15
|
-
# -
|
|
16
|
-
# -
|
|
17
|
-
# -
|
|
18
|
-
# -
|
|
19
|
-
# -
|
|
14
|
+
# - Complete container recreation with preserved configuration
|
|
15
|
+
# - Automatic stop, remove, and recreate sequence
|
|
16
|
+
# - Preserves original container configuration and settings
|
|
17
|
+
# - Configurable stop timeout for graceful shutdown
|
|
18
|
+
# - Handles both running and stopped containers
|
|
19
|
+
# - Maintains container networking and volume configurations
|
|
20
20
|
#
|
|
21
|
-
# ==
|
|
22
|
-
#
|
|
23
|
-
# 1. Retrieve existing container configuration
|
|
24
|
-
# 2. Stop container gracefully (if running)
|
|
25
|
-
# 3. Remove the old container
|
|
26
|
-
# 4. Create new container with identical config
|
|
27
|
-
# 5. Start new container (if original was running)
|
|
21
|
+
# == Security Considerations
|
|
28
22
|
#
|
|
29
|
-
#
|
|
23
|
+
# Container recreation involves several security considerations:
|
|
24
|
+
# - **Service Downtime**: Temporary service interruption during recreation
|
|
25
|
+
# - **Data Loss**: Container file system changes are lost (volumes preserved)
|
|
26
|
+
# - **Resource Allocation**: New container may have different resource usage
|
|
27
|
+
# - **Network Reconfiguration**: IP addresses may change
|
|
28
|
+
# - **State Reset**: Application state within container is lost
|
|
30
29
|
#
|
|
31
|
-
#
|
|
30
|
+
# Plan recreations carefully and coordinate with dependent services.
|
|
32
31
|
#
|
|
33
|
-
#
|
|
34
|
-
# - Container filesystem changes are lost
|
|
35
|
-
# - Temporary data and logs are deleted
|
|
36
|
-
# - Container state is reset completely
|
|
37
|
-
# - Network connections are interrupted
|
|
38
|
-
# - Anonymous volumes may be recreated empty
|
|
32
|
+
# == Parameters
|
|
39
33
|
#
|
|
40
|
-
#
|
|
34
|
+
# - **id**: Container ID or name to recreate (required)
|
|
35
|
+
# - **timeout**: Seconds to wait before killing container when stopping (optional, default: 10)
|
|
41
36
|
#
|
|
42
|
-
#
|
|
43
|
-
# - Sensitive environment variables are maintained
|
|
44
|
-
# - Port mappings and volume mounts are restored
|
|
45
|
-
# - Network access patterns remain the same
|
|
37
|
+
# == Process Flow
|
|
46
38
|
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
39
|
+
# 1. Inspect existing container to capture configuration
|
|
40
|
+
# 2. Stop the running container (if running)
|
|
41
|
+
# 3. Remove the stopped container
|
|
42
|
+
# 4. Create new container with captured configuration
|
|
43
|
+
# 5. Return new container information
|
|
52
44
|
#
|
|
53
45
|
# == Example Usage
|
|
54
46
|
#
|
|
55
47
|
# # Recreate with default timeout
|
|
56
|
-
# RecreateContainer.call(
|
|
48
|
+
# response = RecreateContainer.call(
|
|
57
49
|
# server_context: context,
|
|
58
50
|
# id: "web-server"
|
|
59
51
|
# )
|
|
60
52
|
#
|
|
61
|
-
# # Recreate with
|
|
62
|
-
# RecreateContainer.call(
|
|
53
|
+
# # Recreate with extended timeout
|
|
54
|
+
# response = RecreateContainer.call(
|
|
63
55
|
# server_context: context,
|
|
64
56
|
# id: "database",
|
|
65
57
|
# timeout: 30
|
|
66
58
|
# )
|
|
67
59
|
#
|
|
68
|
-
# @see
|
|
69
|
-
# @see
|
|
70
|
-
# @see
|
|
71
|
-
# @see Docker::Container.create
|
|
60
|
+
# @see ::Docker::Container#stop
|
|
61
|
+
# @see ::Docker::Container#remove
|
|
62
|
+
# @see ::Docker::Container.create
|
|
72
63
|
# @since 0.1.0
|
|
73
|
-
|
|
64
|
+
RECREATE_CONTAINER_DEFINITION = ToolForge.define(:recreate_container) do
|
|
74
65
|
description 'Recreate a Docker container (stops, removes, and recreates with same configuration)'
|
|
75
66
|
|
|
76
|
-
param :id,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
required: false
|
|
67
|
+
param :id,
|
|
68
|
+
type: :string,
|
|
69
|
+
description: 'Container ID or name to recreate'
|
|
80
70
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
# @param id [String] container ID (full or short) or container name
|
|
89
|
-
# @param server_context [Object] RubyLLM context (unused but required)
|
|
90
|
-
# @param timeout [Integer] seconds to wait before force killing during stop (default: 10)
|
|
91
|
-
#
|
|
92
|
-
# @return [RubyLLM::Tool::Response] recreation results with new container ID
|
|
93
|
-
#
|
|
94
|
-
# @raise [Docker::Error::NotFoundError] if container doesn't exist
|
|
95
|
-
# @raise [StandardError] for recreation failures
|
|
96
|
-
#
|
|
97
|
-
# @example Recreate application container
|
|
98
|
-
# response = RecreateContainer.call(
|
|
99
|
-
# server_context: context,
|
|
100
|
-
# id: "my-app"
|
|
101
|
-
# )
|
|
102
|
-
#
|
|
103
|
-
# @example Recreate database with extended timeout
|
|
104
|
-
# response = tool.execute(
|
|
105
|
-
# id: "postgres-main",
|
|
106
|
-
# timeout: 60 # Allow time for DB shutdown
|
|
107
|
-
# )
|
|
108
|
-
#
|
|
109
|
-
# @see Docker::Container.get
|
|
110
|
-
# @see Docker::Container.create
|
|
111
|
-
def execute(id:, timeout: 10)
|
|
71
|
+
param :timeout,
|
|
72
|
+
type: :integer,
|
|
73
|
+
description: 'Seconds to wait before killing the container when stopping (default: 10)',
|
|
74
|
+
required: false,
|
|
75
|
+
default: 10
|
|
76
|
+
|
|
77
|
+
execute do |id:, timeout: 10|
|
|
112
78
|
# Get the existing container
|
|
113
79
|
old_container = ::Docker::Container.get(id)
|
|
114
80
|
config = old_container.json
|
|
@@ -147,5 +113,7 @@ module RubyLLM
|
|
|
147
113
|
"Error recreating container: #{e.message}"
|
|
148
114
|
end
|
|
149
115
|
end
|
|
116
|
+
|
|
117
|
+
RecreateContainer = RECREATE_CONTAINER_DEFINITION.to_ruby_llm_tool
|
|
150
118
|
end
|
|
151
119
|
end
|
|
@@ -2,110 +2,80 @@
|
|
|
2
2
|
|
|
3
3
|
module RubyLLM
|
|
4
4
|
module Docker
|
|
5
|
-
#
|
|
5
|
+
# MCP tool for removing Docker containers.
|
|
6
6
|
#
|
|
7
|
-
# This tool
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
7
|
+
# This tool permanently removes a Docker container from the system,
|
|
8
|
+
# including its file system, configuration, and metadata. This is a
|
|
9
|
+
# destructive operation that cannot be undone. The container must
|
|
10
|
+
# be stopped before removal unless force is specified.
|
|
11
11
|
#
|
|
12
12
|
# == Features
|
|
13
13
|
#
|
|
14
|
-
# -
|
|
15
|
-
# -
|
|
14
|
+
# - Permanent container removal from system
|
|
15
|
+
# - Supports forced removal of running containers
|
|
16
16
|
# - Optional removal of associated volumes
|
|
17
|
-
# -
|
|
18
|
-
# -
|
|
17
|
+
# - Handles container identification by ID or name
|
|
18
|
+
# - Provides comprehensive error handling
|
|
19
|
+
# - Frees all associated system resources
|
|
19
20
|
#
|
|
20
|
-
# ==
|
|
21
|
-
#
|
|
22
|
-
# ⚠️ **DESTRUCTIVE OPERATION** ⚠️
|
|
21
|
+
# == Security Considerations
|
|
23
22
|
#
|
|
24
|
-
#
|
|
25
|
-
# -
|
|
26
|
-
# -
|
|
27
|
-
# -
|
|
28
|
-
# -
|
|
29
|
-
# -
|
|
23
|
+
# Container removal is a destructive operation with implications:
|
|
24
|
+
# - **Data Loss**: Permanently destroys container file system
|
|
25
|
+
# - **Configuration Loss**: Removes container settings and metadata
|
|
26
|
+
# - **Service Disruption**: Eliminates containerized services
|
|
27
|
+
# - **Resource Recovery**: Frees storage, memory, and system resources
|
|
28
|
+
# - **Audit Trail**: May remove forensic evidence if needed
|
|
30
29
|
#
|
|
31
|
-
#
|
|
30
|
+
# Implement proper backup and approval workflows for production systems.
|
|
32
31
|
#
|
|
33
|
-
#
|
|
34
|
-
# - Volume removal may affect other containers
|
|
35
|
-
# - Running container removal terminates services abruptly
|
|
36
|
-
# - Sensitive data in container memory is not securely wiped
|
|
32
|
+
# == Parameters
|
|
37
33
|
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
# -
|
|
34
|
+
# - **id**: Container ID or name (required)
|
|
35
|
+
# - Accepts full container IDs
|
|
36
|
+
# - Accepts short container IDs (first 12+ characters)
|
|
37
|
+
# - Accepts custom container names
|
|
38
|
+
# - **force**: Force removal of running container (optional, default: false)
|
|
39
|
+
# - **volumes**: Remove associated volumes (optional, default: false)
|
|
43
40
|
#
|
|
44
41
|
# == Example Usage
|
|
45
42
|
#
|
|
46
43
|
# # Remove stopped container
|
|
47
|
-
# RemoveContainer.call(
|
|
44
|
+
# response = RemoveContainer.call(
|
|
48
45
|
# server_context: context,
|
|
49
|
-
# id: "old-
|
|
46
|
+
# id: "old-web-server"
|
|
50
47
|
# )
|
|
51
48
|
#
|
|
52
49
|
# # Force remove running container with volumes
|
|
53
|
-
# RemoveContainer.call(
|
|
50
|
+
# response = RemoveContainer.call(
|
|
54
51
|
# server_context: context,
|
|
55
52
|
# id: "problematic-container",
|
|
56
53
|
# force: true,
|
|
57
54
|
# volumes: true
|
|
58
55
|
# )
|
|
59
56
|
#
|
|
60
|
-
# @see
|
|
61
|
-
# @see CreateContainer
|
|
62
|
-
# @see Docker::Container#delete
|
|
57
|
+
# @see ::Docker::Container#remove
|
|
63
58
|
# @since 0.1.0
|
|
64
|
-
|
|
59
|
+
REMOVE_CONTAINER_DEFINITION = ToolForge.define(:remove_container) do
|
|
65
60
|
description 'Remove a Docker container'
|
|
66
61
|
|
|
67
|
-
param :id,
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
param :id,
|
|
63
|
+
type: :string,
|
|
64
|
+
description: 'Container ID or name'
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
#
|
|
85
|
-
# @raise [Docker::Error::NotFoundError] if container doesn't exist
|
|
86
|
-
# @raise [StandardError] for other removal failures
|
|
87
|
-
#
|
|
88
|
-
# @example Remove stopped container
|
|
89
|
-
# response = RemoveContainer.call(
|
|
90
|
-
# server_context: context,
|
|
91
|
-
# id: "finished-job"
|
|
92
|
-
# )
|
|
93
|
-
#
|
|
94
|
-
# @example Force remove running container
|
|
95
|
-
# response = RemoveContainer.call(
|
|
96
|
-
# server_context: context,
|
|
97
|
-
# id: "stuck-container",
|
|
98
|
-
# force: true
|
|
99
|
-
# )
|
|
100
|
-
#
|
|
101
|
-
# @example Remove container and its volumes
|
|
102
|
-
# response = tool.execute(
|
|
103
|
-
# id: "temp-container",
|
|
104
|
-
# volumes: true
|
|
105
|
-
# )
|
|
106
|
-
#
|
|
107
|
-
# @see Docker::Container#delete
|
|
108
|
-
def execute(id:, force: false, volumes: false)
|
|
66
|
+
param :force,
|
|
67
|
+
type: :boolean,
|
|
68
|
+
description: 'Force removal of running container (default: false)',
|
|
69
|
+
required: false,
|
|
70
|
+
default: false
|
|
71
|
+
|
|
72
|
+
param :volumes,
|
|
73
|
+
type: :boolean,
|
|
74
|
+
description: 'Remove associated volumes (default: false)',
|
|
75
|
+
required: false,
|
|
76
|
+
default: false
|
|
77
|
+
|
|
78
|
+
execute do |id:, force: false, volumes: false|
|
|
109
79
|
container = ::Docker::Container.get(id)
|
|
110
80
|
container.delete(force: force, v: volumes)
|
|
111
81
|
|
|
@@ -116,5 +86,7 @@ module RubyLLM
|
|
|
116
86
|
"Error removing container: #{e.message}"
|
|
117
87
|
end
|
|
118
88
|
end
|
|
89
|
+
|
|
90
|
+
RemoveContainer = REMOVE_CONTAINER_DEFINITION.to_ruby_llm_tool
|
|
119
91
|
end
|
|
120
92
|
end
|
|
@@ -2,132 +2,88 @@
|
|
|
2
2
|
|
|
3
3
|
module RubyLLM
|
|
4
4
|
module Docker
|
|
5
|
-
#
|
|
5
|
+
# MCP tool for removing Docker images.
|
|
6
6
|
#
|
|
7
|
-
# This tool provides the ability to
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
# handling.
|
|
7
|
+
# This tool provides the ability to delete Docker images from the
|
|
8
|
+
# local Docker daemon. It supports various removal options including
|
|
9
|
+
# forced removal and parent image cleanup management.
|
|
11
10
|
#
|
|
12
11
|
# == Features
|
|
13
12
|
#
|
|
14
|
-
# - Remove images by ID, name, or
|
|
13
|
+
# - Remove images by ID, name, or tag
|
|
15
14
|
# - Force removal of images in use
|
|
16
|
-
# - Control parent image cleanup
|
|
15
|
+
# - Control untagged parent image cleanup
|
|
17
16
|
# - Comprehensive error handling
|
|
17
|
+
# - Validation of image existence
|
|
18
18
|
# - Safe removal with dependency checking
|
|
19
19
|
#
|
|
20
|
-
# == ⚠️ Data Loss Warning ⚠️
|
|
21
|
-
#
|
|
22
|
-
# **DESTRUCTIVE OPERATION - PERMANENT DATA LOSS**
|
|
23
|
-
#
|
|
24
|
-
# This operation permanently deletes images and associated data:
|
|
25
|
-
# - Image layers are deleted from disk
|
|
26
|
-
# - All tags pointing to the image are removed
|
|
27
|
-
# - Operation cannot be undone
|
|
28
|
-
# - Dependent containers may become unusable
|
|
29
|
-
# - Custom modifications to images are lost
|
|
30
|
-
#
|
|
31
|
-
# == Dependency Management
|
|
32
|
-
#
|
|
33
|
-
# Docker images have complex dependency relationships:
|
|
34
|
-
# - **Child Images**: Images built FROM this image
|
|
35
|
-
# - **Parent Images**: Base images this image depends on
|
|
36
|
-
# - **Running Containers**: Containers using this image
|
|
37
|
-
# - **Stopped Containers**: Containers that could be restarted
|
|
38
|
-
#
|
|
39
20
|
# == Security Considerations
|
|
40
21
|
#
|
|
41
|
-
# Image removal
|
|
42
|
-
# -
|
|
43
|
-
# -
|
|
44
|
-
# -
|
|
45
|
-
# -
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
22
|
+
# Image removal involves important considerations:
|
|
23
|
+
# - **Data Loss**: Removed images cannot be recovered locally
|
|
24
|
+
# - **Service Disruption**: Removing images used by running containers
|
|
25
|
+
# - **Storage Cleanup**: Improper cleanup can leave orphaned layers
|
|
26
|
+
# - **Registry Impact**: Local removal doesn't affect registry copies
|
|
27
|
+
# - **Dependency Conflicts**: Force removal can break container dependencies
|
|
28
|
+
#
|
|
29
|
+
# **Security Recommendations**:
|
|
30
|
+
# - Verify image is not in use before removal
|
|
31
|
+
# - Use force option only when necessary
|
|
32
|
+
# - Consider impact on running containers
|
|
49
33
|
# - Backup important images before removal
|
|
50
|
-
# -
|
|
51
|
-
# -
|
|
52
|
-
# - Maintain image inventory documentation
|
|
34
|
+
# - Monitor disk space after removal operations
|
|
35
|
+
# - Implement image lifecycle policies
|
|
53
36
|
#
|
|
54
|
-
# ==
|
|
37
|
+
# == Parameters
|
|
55
38
|
#
|
|
56
|
-
# - **
|
|
57
|
-
# - **Force
|
|
58
|
-
# - **
|
|
59
|
-
# - **No Prune**: Keeps parent images even if unused
|
|
39
|
+
# - **id**: Image ID, name, or name:tag (required)
|
|
40
|
+
# - **force**: Force removal of the image (optional, default: false)
|
|
41
|
+
# - **noprune**: Do not delete untagged parents (optional, default: false)
|
|
60
42
|
#
|
|
61
43
|
# == Example Usage
|
|
62
44
|
#
|
|
63
|
-
# #
|
|
64
|
-
# RemoveImage.call(
|
|
45
|
+
# # Remove specific image
|
|
46
|
+
# response = RemoveImage.call(
|
|
65
47
|
# server_context: context,
|
|
66
|
-
# id: "old-
|
|
48
|
+
# id: "myapp:old-version"
|
|
67
49
|
# )
|
|
68
50
|
#
|
|
69
|
-
# # Force
|
|
70
|
-
# RemoveImage.call(
|
|
51
|
+
# # Force remove image in use
|
|
52
|
+
# response = RemoveImage.call(
|
|
71
53
|
# server_context: context,
|
|
72
|
-
# id: "
|
|
54
|
+
# id: "abc123def456",
|
|
73
55
|
# force: true
|
|
74
56
|
# )
|
|
75
57
|
#
|
|
76
|
-
# # Remove
|
|
77
|
-
# RemoveImage.call(
|
|
58
|
+
# # Remove without cleaning parent images
|
|
59
|
+
# response = RemoveImage.call(
|
|
78
60
|
# server_context: context,
|
|
79
|
-
# id: "
|
|
61
|
+
# id: "test-image:latest",
|
|
80
62
|
# noprune: true
|
|
81
63
|
# )
|
|
82
64
|
#
|
|
83
|
-
# @see
|
|
84
|
-
# @see BuildImage
|
|
85
|
-
# @see Docker::Image#remove
|
|
65
|
+
# @see ::Docker::Image#remove
|
|
86
66
|
# @since 0.1.0
|
|
87
|
-
|
|
67
|
+
REMOVE_IMAGE_DEFINITION = ToolForge.define(:remove_image) do
|
|
88
68
|
description 'Remove a Docker image'
|
|
89
69
|
|
|
90
|
-
param :id,
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
param :id,
|
|
71
|
+
type: :string,
|
|
72
|
+
description: 'Image ID, name, or name:tag'
|
|
73
|
+
|
|
74
|
+
param :force,
|
|
75
|
+
type: :boolean,
|
|
76
|
+
description: 'Force removal of the image (default: false)',
|
|
77
|
+
required: false,
|
|
78
|
+
default: false
|
|
93
79
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
# @param server_context [Object] RubyLLM context (unused but required)
|
|
102
|
-
# @param force [Boolean] whether to force removal despite dependencies (default: false)
|
|
103
|
-
# @param noprune [Boolean] whether to preserve parent images (default: false)
|
|
104
|
-
#
|
|
105
|
-
# @return [RubyLLM::Tool::Response] removal operation results
|
|
106
|
-
#
|
|
107
|
-
# @raise [Docker::Error::NotFoundError] if image doesn't exist
|
|
108
|
-
# @raise [StandardError] for removal failures or dependency conflicts
|
|
109
|
-
#
|
|
110
|
-
# @example Remove unused image
|
|
111
|
-
# response = RemoveImage.call(
|
|
112
|
-
# server_context: context,
|
|
113
|
-
# id: "old-version:1.0"
|
|
114
|
-
# )
|
|
115
|
-
#
|
|
116
|
-
# @example Force remove problematic image
|
|
117
|
-
# response = RemoveImage.call(
|
|
118
|
-
# server_context: context,
|
|
119
|
-
# id: "corrupted-image",
|
|
120
|
-
# force: true
|
|
121
|
-
# )
|
|
122
|
-
#
|
|
123
|
-
# @example Remove while preserving layers
|
|
124
|
-
# response = tool.execute(
|
|
125
|
-
# id: "temp-image:build-123",
|
|
126
|
-
# noprune: true
|
|
127
|
-
# )
|
|
128
|
-
#
|
|
129
|
-
# @see Docker::Image#remove
|
|
130
|
-
def execute(id:, force: false, noprune: false)
|
|
80
|
+
param :noprune,
|
|
81
|
+
type: :boolean,
|
|
82
|
+
description: 'Do not delete untagged parents (default: false)',
|
|
83
|
+
required: false,
|
|
84
|
+
default: false
|
|
85
|
+
|
|
86
|
+
execute do |id:, force: false, noprune: false|
|
|
131
87
|
image = ::Docker::Image.get(id)
|
|
132
88
|
image.remove(force: force, noprune: noprune)
|
|
133
89
|
|
|
@@ -138,5 +94,7 @@ module RubyLLM
|
|
|
138
94
|
"Error removing image: #{e.message}"
|
|
139
95
|
end
|
|
140
96
|
end
|
|
97
|
+
|
|
98
|
+
RemoveImage = REMOVE_IMAGE_DEFINITION.to_ruby_llm_tool
|
|
141
99
|
end
|
|
142
100
|
end
|