Skip to content

Commit 8f018ff

Browse files
authored
Merge pull request #1997 from effigies/mnt/no_network
CI: Test that Docker image can run a common set of output spaces without network access
2 parents f9b2f53 + 4fbbb59 commit 8f018ff

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ jobs:
365365
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
366366
fmriprep-docker -i poldracklab/fmriprep:latest \
367367
-e FMRIPREP_DEV 1 -u $(id -u) \
368+
--network none \
368369
--config $PWD/nipype.cfg -w /tmp/ds005/work \
369370
/tmp/data/ds005 /tmp/ds005/derivatives participant \
370371
--fs-subjects-dir /tmp/ds005/freesurfer \
@@ -393,6 +394,7 @@ jobs:
393394
sudo setfacl -m group:$(id -gn):rwx /tmp/ds005/work
394395
fmriprep-docker -i poldracklab/fmriprep:latest \
395396
-e FMRIPREP_DEV 1 -u $(id -u) \
397+
--network none \
396398
--config $PWD/nipype.cfg -w /tmp/ds005/work \
397399
/tmp/data/ds005 /tmp/ds005/derivatives participant \
398400
--fs-subjects-dir /tmp/ds005/freesurfer \
@@ -422,6 +424,7 @@ jobs:
422424
rm /tmp/data/ds005/sub-01/func/*_run-01_*
423425
fmriprep-docker -i poldracklab/fmriprep:latest \
424426
-e FMRIPREP_DEV 1 -u $(id -u) \
427+
--network none \
425428
--config $PWD/nipype.cfg -w /tmp/ds005/work_partial \
426429
/tmp/data/ds005 /tmp/ds005/derivatives_partial participant \
427430
--fs-subjects-dir /tmp/ds005/freesurfer \

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ RUN pip install --no-cache-dir "$( grep templateflow fmriprep-setup.cfg | xargs
170170
tfapi.get('MNI152NLin6Asym', atlas=None, resolution=[1, 2], \
171171
desc='brain', extension=['.nii', '.nii.gz']); \
172172
tfapi.get('MNI152NLin2009cAsym', atlas=None, extension=['.nii', '.nii.gz']); \
173-
tfapi.get('OASIS30ANTs', extension=['.nii', '.nii.gz']);" && \
173+
tfapi.get('OASIS30ANTs', extension=['.nii', '.nii.gz']); \
174+
tfapi.get('fsLR', space='fsaverage', density='164k'); \
175+
tfapi.get('fsLR', space=None, density='32k'); \
176+
tfapi.get('MNI152NLin6Asym', resolution=2, atlas='HCP', suffix='dseg')" && \
174177
rm fmriprep-setup.cfg && \
175178
find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \
176179
find $HOME/.cache/templateflow -type f -exec chmod go=u {} +

wrapper/fmriprep_docker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ def get_parser():
296296
help='Set custom environment variable within container')
297297
g_dev.add_argument('-u', '--user', action='store',
298298
help='Run container as a given user/uid')
299+
g_dev.add_argument('--network', action='store',
300+
help='Run container with a different network driver '
301+
'("none" to simulate no internet connection)')
299302

300303
return parser
301304

@@ -434,6 +437,9 @@ def main():
434437
if opts.shell:
435438
command.append('--entrypoint=bash')
436439

440+
if opts.network:
441+
command.append('--network=' + opts.network)
442+
437443
command.append(opts.image)
438444

439445
# Override help and version to describe underlying program

0 commit comments

Comments
 (0)