Skip to content

Commit

Permalink
fix volumes with read-only rootfs
Browse files Browse the repository at this point in the history
  • Loading branch information
xi committed Apr 28, 2023
1 parent 1c55b15 commit 8e8e6ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions d-run
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def make_volume(path, dir):
def build_cmd(dir, config):
cmd = [
'bwrap',
'--ro-bind', os.path.join(dir, 'rootfs'), '/',
'--bind', os.path.join(dir, 'rootfs'), '/',
'--tmpfs', '/tmp',
'--dev', '/dev',
'--proc', '/proc',
Expand All @@ -37,9 +37,6 @@ def build_cmd(dir, config):
'--die-with-parent',
]

if config.get('rw'):
cmd[1] = '--bind'

if config.get('Hostname'):
cmd += ['--hostname', config['Hostname']]
if config.get('WorkingDir'):
Expand All @@ -53,6 +50,9 @@ def build_cmd(dir, config):
for volume in config['Volumes']:
cmd += make_volume(volume, dir)

if not config.get('rw'):
cmd += ['--remount-ro', '/']

if config.get('net'):
cmd += [
'--ro-bind', '/etc/resolv.conf', '/etc/resolv.conf',
Expand Down

0 comments on commit 8e8e6ba

Please sign in to comment.