Browse Source

Add --pull argument to pull an updated image

tags/v0.1.1
Chris Smith 7 years ago
parent
commit
83418b50f1
2 changed files with 26 additions and 8 deletions
  1. 20
    8
      README.md
  2. 6
    0
      docker-rerun

+ 20
- 8
README.md View File

45
 If a container uses an argument that's not supported yet, it will be silently
45
 If a container uses an argument that's not supported yet, it will be silently
46
 dropped when rerunning.
46
 dropped when rerunning.
47
 
47
 
48
-
49
-The following arguments can be used when executing `docker-rerun` to modify
50
-the resulting container:
51
-
52
- * `--image <image>` - changes the image that will be used. You can specify
53
-   tags (`name:tag`) or digests (`name@digest`) as with `docker run`.
54
- * `-p <port>` or `--port <port>` - expose additional ports. Same format
55
-   as `docker run`'s `-p` option.
48
+## Arguments
49
+
50
+The built-in help shows all available arguments. `--dry-run` and `--pull`
51
+affect the behaviour of `docker-rerun`; other options allow modification
52
+of the container's parameters.
53
+
54
+    usage: docker-rerun [-h] [-d] [--pull] [--image IMAGE] [--port PORT] container
55
+    
56
+    Reruns docker containers with different parameters.
57
+    
58
+    positional arguments:
59
+      container             The container to rerun
60
+    
61
+    optional arguments:
62
+      -h, --help            show this help message and exit
63
+      -d, --dry-run         Don't actually re-run the container, just print what
64
+                            would happen.
65
+      --pull                Docker pull the image before re-running the container
66
+      --image IMAGE         Image to use in place of the original
67
+      --port PORT, -p PORT  Additional port to expose
56
 
68
 
57
 ## What's not done yet
69
 ## What's not done yet
58
 
70
 

+ 6
- 0
docker-rerun View File

266
     parser.add_argument('-d', '--dry-run', action='store_true',
266
     parser.add_argument('-d', '--dry-run', action='store_true',
267
                         help='Don\'t actually re-run the container, just ' \
267
                         help='Don\'t actually re-run the container, just ' \
268
                              'print what would happen.')
268
                              'print what would happen.')
269
+    parser.add_argument('--pull', action='store_true',
270
+                        help='Docker pull the image before re-running the ' \
271
+                             'container')
269
 
272
 
270
     mods = modifiers()
273
     mods = modifiers()
271
     for mod in mods:
274
     for mod in mods:
288
         container.command_line(),
291
         container.command_line(),
289
     ]
292
     ]
290
 
293
 
294
+    if args.pull:
295
+        commands = [['docker', 'pull', container.image]] + commands
296
+
291
     if args.dry_run:
297
     if args.dry_run:
292
         print('Performing dry run for container %s. The following would be ' \
298
         print('Performing dry run for container %s. The following would be ' \
293
               'executed:' % args.container)
299
               'executed:' % args.container)

Loading…
Cancel
Save