Browse Source

Support for copying commands.

tags/v0.1.1
Chris Smith 7 years ago
parent
commit
9fce2046c8
3 changed files with 12 additions and 1 deletions
  1. 1
    1
      README.md
  2. 9
    0
      docker-rerun
  3. 2
    0
      test.py

+ 1
- 1
README.md View File

26
 
26
 
27
 At present docker-rerun supports a small number of commonly used arguments:
27
 At present docker-rerun supports a small number of commonly used arguments:
28
 
28
 
29
+    * Commands (trailing arguments)
29
     * Names (--name)
30
     * Names (--name)
30
     * Networks (--net)
31
     * Networks (--net)
31
     * Port publications (-p)
32
     * Port publications (-p)
36
 
37
 
37
 Many other command line arguments:
38
 Many other command line arguments:
38
 
39
 
39
-    * Commands
40
     * Environment variables
40
     * Environment variables
41
     * Labels
41
     * Labels
42
     * Linking and aliases
42
     * Linking and aliases

+ 9
- 0
docker-rerun View File

84
                                  lambda c: c['HostConfig']['Binds'])
84
                                  lambda c: c['HostConfig']['Binds'])
85
 
85
 
86
 
86
 
87
+def handle_command(container):
88
+    """Copies the command (trailing arguments)."""
89
+    cont_cmd = container.info['Config']['Cmd']
90
+    image_cmd = container.image_info['Config']['Cmd']
91
+
92
+    if cont_cmd != image_cmd:
93
+        container.cmd = cont_cmd
94
+
95
+
87
 def handle_image(container):
96
 def handle_image(container):
88
     """Copies the image argument."""
97
     """Copies the image argument."""
89
     container.image = container.info['Config']['Image']
98
     container.image = container.info['Config']['Image']

+ 2
- 0
test.py View File

16
     def test_command_matches(self):
16
     def test_command_matches(self):
17
         commands = [
17
         commands = [
18
             'docker run --name=test123 -d hello-world',
18
             'docker run --name=test123 -d hello-world',
19
+            'docker run --name=test123 -d hello-world:latest',
20
+            'docker run --name=test123 -d hello-world /hello world...',
19
             'docker run --name=test123 --restart=always -d hello-world',
21
             'docker run --name=test123 --restart=always -d hello-world',
20
             'docker run --name=test123 --restart=on-failure:10 -d hello-world',
22
             'docker run --name=test123 --restart=on-failure:10 -d hello-world',
21
             'docker run --name=test123 --net=host -d hello-world',
23
             'docker run --name=test123 --net=host -d hello-world',

Loading…
Cancel
Save