Skip to content

Commit

Permalink
Add Podman support (#248)
Browse files Browse the repository at this point in the history
Podman needs `--userns=keep-id` because we otherwise end up with files
being owned by root in the container, and `--security-opt label=disable`
because SELinux blocks access otherwise.
  • Loading branch information
michaelkuhn committed May 18, 2023
1 parent a7afc3e commit 4d70d6e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions outputs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# Tools
DOCKER := docker
DOCKER_RUN_OPTS :=

# Use this for Podman
#DOCKER := podman
#DOCKER_RUN_OPTS := --userns=keep-id --security-opt label=disable

# Name of the container we'll generate the tutorial outputs with
container := ghcr.io/spack/tutorial:latest
Expand All @@ -28,13 +33,13 @@ $(addprefix local-run-,$(sections)):
$(CURDIR)/$(@:local-run-%=%).sh

$(run_targets): run-%: %.sh init_spack.sh defs.sh
$(DOCKER) run --rm -t \
$(DOCKER) run $(DOCKER_RUN_OPTS) --rm -t \
--mount type=bind,source=$(CURDIR),target=/project \
${container} \
/project/$(@:run-%=%).sh && touch $@

interactive:
$(DOCKER) run --rm -it \
$(DOCKER) run $(DOCKER_RUN_OPTS) --rm -it \
--mount type=bind,source=$(CURDIR),target=/project \
${container}

Expand Down

0 comments on commit 4d70d6e

Please sign in to comment.