docker-rake-flow 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile.rb +1 -0
- data/lib/utils.rb +35 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cadb7093fd4fcf80cc28ac9fff1b9f2716c30027
|
4
|
+
data.tar.gz: e6d65bea0e481ad30e5f571485bc8b86ca1299c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5eac9ea90aa27bb5893610a7977392eeb43df2ec3c50ffb779ae5da6ad77ee1ba32ceff4f2a2e623766936a56c0c2452443c04d9e1b0785d0f39ba8ea4204cd
|
7
|
+
data.tar.gz: b2973782d53ad95ee091ab2c0dc2a2876efb3042eb9670a6d11d1d3dddf071f383673147535f31d9d1bd5ca2ca7a9442ca3e459015258839db9dc72140c55cc7
|
data/Rakefile.rb
CHANGED
data/lib/utils.rb
CHANGED
@@ -116,4 +116,39 @@ class DockerFlow::Utils
|
|
116
116
|
container.stop
|
117
117
|
container.delete
|
118
118
|
end
|
119
|
+
|
120
|
+
def self.clean_images(repository)
|
121
|
+
puts "Cleaning up Docker"
|
122
|
+
# Clean exited containers
|
123
|
+
for container in Docker::Container.all(all: true, filters: { status: ["exited"] }.to_json)
|
124
|
+
puts container.id
|
125
|
+
container.stop
|
126
|
+
container.delete(:force => true)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Remove dangling images
|
130
|
+
for image in Docker::Image.all(all: true, filters: { dangling: ["true"] }.to_json)
|
131
|
+
puts image.id
|
132
|
+
begin
|
133
|
+
image.remove(:force => true)
|
134
|
+
rescue Docker::Error::NotFoundError
|
135
|
+
# Image already removed
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# Clean tagged images
|
140
|
+
for image in Docker::Image.all
|
141
|
+
# puts image.info["RepoTags"]
|
142
|
+
for repoTag in image.info["RepoTags"]
|
143
|
+
if repoTag.include? repository
|
144
|
+
puts repoTag
|
145
|
+
begin
|
146
|
+
image.remove(:force => true)
|
147
|
+
rescue Docker::Error::NotFoundError
|
148
|
+
# Image already removed
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
119
154
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-rake-flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VJ Patel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|