Skip to content

Commit 7bdf038

Browse files
Make dev container compatible with podman (#178)
Following the issue described in #174 (comment). This prevents permission issues when using the dev container with `podman`, which is running rootless. Usage with `docker` requires explicitly passing `UID` and `GID` of the local user, which is added to the README. Add podman command to `README.md` Co-authored-by: NeroBurner <[email protected]> --------- Co-authored-by: NeroBurner <[email protected]>
1 parent 8cb1ef4 commit 7bdf038

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhisto
4848
&& chown -R $USERNAME /commandhistory \
4949
&& echo "$SNIPPET" >> "/home/$USERNAME/.bashrc"
5050

51-
USER ubuntu
52-
5351
# Section for interactive compilation during docker run
5452

5553
WORKDIR /sources

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,24 @@ docker build -t infinisim-build .devcontainer
121121

122122
Afterwards you can build the simulator with:
123123
```sh
124-
docker run --rm -it -v ${PWD}:/sources infinisim-build
124+
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinisim-build
125+
```
126+
127+
Note: when using rootless `podman` instead of `docker` the `--user` part can be left out.
128+
The command to build the simulator using `podman` is:
129+
```sh
130+
podman run --rm -it -v ${PWD}:/sources infinisim-build
125131
```
126132

127133
By default this builds the simulator using the InfiniTime files from the submodule in your `${PWD}`.
128134
If you want to use a different repository, you got to mount it and pass the path to the `INFINITIME_DIR` variable:
129135
```sh
130-
docker run --rm -it -v ${PWD}:/sources -v ${PWD}/../InfiniTime:/infinitime -e INFINITIME_DIR=/infinitime infinisim-build
136+
docker run --rm -it -v ${PWD}:/sources -v ${PWD}/../InfiniTime:/infinitime -e INFINITIME_DIR=/infinitime --user $(id -u):$(id -g) infinisim-build
131137
```
132138

133139
Other CMake generation and build arguments can be passed to the `GENERATE_ARGS` and `BUILD_ARGS` variables:
134140
```sh
135-
docker run --rm -it -v ${PWD}:/sources -e GENERATE_ARGS=-DENABLE_USERAPPS="Apps::Timer,Apps::Alarm" -e BUILD_ARGS=-j16 infinisim-build
141+
docker run --rm -it -v ${PWD}:/sources -e GENERATE_ARGS=-DENABLE_USERAPPS="Apps::Timer,Apps::Alarm" -e BUILD_ARGS=-j16 --user $(id -u):$(id -g) infinisim-build
136142
```
137143

138144

0 commit comments

Comments
 (0)