Skip to content

Commit 60d2517

Browse files
authored
Merge pull request #1223 from oesteban/enh/docker-user-flag
[ENH] Enable ``-u`` (docker user/userid) flag in wrapper
2 parents 466ecc0 + 0fd7bde commit 60d2517

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ jobs:
326326
sudo setfacl -d -m group:$(id -gn):rwx /tmp/ds005/work && \
327327
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
328328
fmriprep-docker -i poldracklab/fmriprep:latest \
329-
-e FMRIPREP_DEV 1 \
329+
-e FMRIPREP_DEV 1 -u $(id -u) \
330330
--config $PWD/nipype.cfg -w /tmp/ds005/work \
331331
/tmp/data/ds005 /tmp/ds005/derivatives participant \
332332
--debug --write-graph --mem_mb 4096 \
@@ -346,7 +346,7 @@ jobs:
346346
sudo setfacl -d -m group:$(id -gn):rwx /tmp/ds005/work && \
347347
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
348348
fmriprep-docker -i poldracklab/fmriprep:latest \
349-
-e FMRIPREP_DEV 1 \
349+
-e FMRIPREP_DEV 1 -u $(id -u) \
350350
--config $PWD/nipype.cfg -w /tmp/ds005/work \
351351
/tmp/data/ds005 /tmp/ds005/derivatives participant \
352352
--debug --write-graph --use-syn-sdc --mem_mb 4096 \
@@ -373,7 +373,7 @@ jobs:
373373
command: |
374374
rm /tmp/data/ds005/sub-01/func/*_run-02_*
375375
fmriprep-docker -i poldracklab/fmriprep:latest \
376-
-e FMRIPREP_DEV 1 \
376+
-e FMRIPREP_DEV 1 -u $(id -u) \
377377
--config $PWD/nipype.cfg -w /tmp/ds005/work \
378378
/tmp/data/ds005 /tmp/ds005/derivatives_partial participant \
379379
--debug --write-graph --use-syn-sdc --mem_mb 4096 \

wrapper/fmriprep_docker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ def get_parser():
286286
type=os.path.abspath, help='Use custom nipype.cfg file')
287287
g_dev.add_argument('-e', '--env', action='append', nargs=2, metavar=('ENV_VAR', 'value'),
288288
help='Set custom environment variable within container')
289+
g_dev.add_argument('-u', '--user', action='store',
290+
help='Run container as a given user/uid')
289291

290292
return parser
291293

@@ -363,6 +365,9 @@ def main():
363365
for envvar in opts.env:
364366
command.extend(['-e', '%s=%s' % tuple(envvar)])
365367

368+
if opts.user:
369+
command.extend(['-u', opts.user])
370+
366371
if opts.fs_license_file:
367372
command.extend([
368373
'-v', '{}:/opt/freesurfer/license.txt:ro'.format(

0 commit comments

Comments
 (0)