- commit
- 2262ab97547b4c3ac71c44d8de9d1786d4345d60
- parent
- 7d76f596926a48a24a7b6b6e0ca857bffbf27753
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-10-27 18:43
default to read-only image
Diffstat
| M | README.md | 8 | +++++--- |
| M | d-run | 8 | +++++++- |
2 files changed, 12 insertions, 4 deletions
diff --git a/README.md b/README.md
@@ -23,13 +23,15 @@ that are actually used by `d-run`: 23 23 24 24 - `net` (bool) - enable networking (default: false) 25 25 - `fakeroot` (bool) - map UID and GID to 0 (default: false) -1 26 - `rw` (bool) - allow to modify the base image (default: false) 26 27 27 28 You are encouraged to modify this file, e.g. to add a volume or change the 28 29 default command. 29 3030 -1 You can also modify the rootfs, both from a running container and from the host31 -1 system. If you need a new container based on the same image you can just run32 -1 `d-pull` again. The layers are cached in `~/.cache/d-utils/` for 30 days.-1 31 You can also modify the rootfs, both from a running container (if it uses the -1 32 `rw` option) and from the host system. If you need a new container based on the -1 33 same image you can just run `d-pull` again. The layers are cached in -1 34 `~/.cache/d-utils/` for 30 days. 33 35 34 36 # Motivation 35 37
diff --git a/d-run b/d-run
@@ -25,7 +25,7 @@ def make_volume(path, dir): 25 25 def build_cmd(dir, config): 26 26 cmd = [ 27 27 'bwrap',28 -1 '--bind', os.path.join(dir, 'rootfs'), '/',-1 28 '--ro-bind', os.path.join(dir, 'rootfs'), '/', 29 29 '--tmpfs', '/tmp', 30 30 '--dev', '/dev', 31 31 '--proc', '/proc', @@ -34,6 +34,9 @@ def build_cmd(dir, config): 34 34 '--die-with-parent', 35 35 ] 36 36 -1 37 if config.get('rw'): -1 38 cmd[1] = '--bind' -1 39 37 40 if config.get('Hostname'): 38 41 cmd += ['--hostname', config['Hostname']] 39 42 if config.get('WorkingDir'): @@ -73,6 +76,7 @@ def parse_args(): 73 76 parser.add_argument('-v', '--volume', action='append') 74 77 parser.add_argument('-n', '--net', action='store_true') 75 78 parser.add_argument('-r', '--fakeroot', action='store_true') -1 79 parser.add_argument('-w', '--rw', action='store_true') 76 80 parser.add_argument('cmd', nargs='*') 77 81 return parser.parse_args() 78 82 @@ -87,6 +91,8 @@ if __name__ == '__main__': 87 91 config['Cmd'] = args.cmd 88 92 if args.net: 89 93 config['net'] = True -1 94 if args.rw: -1 95 config['rw'] = True 90 96 if args.fakeroot: 91 97 config['fakeroot'] = True 92 98 if args.volume: