@@ -124,6 +124,9 @@ struct CONFIG {
124
124
string project_dir_mount;
125
125
// mount project dir here in container
126
126
// default: don't mount it
127
+ string image_name;
128
+ // use this as the image name, and don't delete it when done.
129
+ // For testing.
127
130
void print () {
128
131
fprintf (stderr, " Wrapper config file:\n " );
129
132
if (!workdir.empty ()) {
@@ -173,6 +176,10 @@ int parse_config_file() {
173
176
if (x) {
174
177
config.project_dir_mount = x->as <string>();
175
178
}
179
+ x = v.find (" image_name" );
180
+ if (x) {
181
+ config.image_name = x->as <string>();
182
+ }
176
183
return 0 ;
177
184
}
178
185
@@ -190,8 +197,12 @@ int error_output(vector<string> &out) {
190
197
// //////// IMAGE ////////////
191
198
192
199
void get_image_name () {
193
- string s = docker_image_name (project_dir, aid.wu_name );
194
- strcpy (image_name, s.c_str ());
200
+ if (config.image_name .empty ()) {
201
+ string s = docker_image_name (project_dir, aid.wu_name );
202
+ strcpy (image_name, s.c_str ());
203
+ } else {
204
+ strcpy (image_name, config.image_name .c_str ());
205
+ }
195
206
}
196
207
197
208
int image_exists (bool &exists) {
@@ -341,8 +352,12 @@ void cleanup() {
341
352
sprintf (cmd, " container rm %s" , container_name);
342
353
docker_conn.command (cmd, out);
343
354
344
- sprintf (cmd, " image rm %s" , image_name);
345
- docker_conn.command (cmd, out);
355
+ // don't remove image if it was specified in config
356
+ //
357
+ if (config.image_name .empty ()) {
358
+ sprintf (cmd, " image rm %s" , image_name);
359
+ docker_conn.command (cmd, out);
360
+ }
346
361
}
347
362
348
363
void poll_client_msgs () {
0 commit comments