Skip to content

Commit 4c2cdcf

Browse files
committed
docker: markdown blocks / hugo clash
curly brackets did not go well with the hugo update #359
1 parent 9c3fcb6 commit 4c2cdcf

File tree

7 files changed

+84
-78
lines changed

7 files changed

+84
-78
lines changed

content/tutorials/development_containers1/index.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Either way, note that you need to run the docker app or docker in a terminal *as
138138
More info about the installation on your specific Linux operation systems [can be found here](https://docs.docker.com/engine/install).
139139
The procedure for Debian or Ubuntu-based distributions involves trusting dockers gpg keys and adding an extra repository, [some caution is warranted](https://wiki.debian.org/DontBreakDebian).
140140

141-
``` {sh}
141+
``` sh
142142
#| eval: false
143143
sudo apt update && sudo apt install docker-ce docker-buildx-plugin # debian-based
144144
# sudo pacman -Sy docker docker-buildx # Arch Linux
@@ -151,7 +151,7 @@ Many features which you would take for granted in this kind of software (securit
151151
For users to be able to use Docker, they must be in the "docker" group.
152152
(Insert your username at `<your-username>`.)
153153

154-
``` {sh}
154+
``` sh
155155
#| eval: false
156156
sudo usermod -a -G docker <your-username>
157157
```
@@ -165,7 +165,7 @@ However, due to [diverse](https://docs.docker.com/engine/security) [security](ht
165165

166166
On a `systemd` system, you can start and stop Docker on demand via the following commands (those will ask you for `sudo` authentification if necessary).
167167

168-
``` {sh}
168+
``` sh
169169
#| eval: false
170170
systemctl start docker
171171

@@ -179,7 +179,7 @@ For aficionados: docker actually runs multiple services: the docker service, the
179179

180180
You can check the Docker installation by confirming the version at which the service is running.
181181

182-
``` {sh}
182+
``` sh
183183
#| eval: false
184184
docker --version
185185
```
@@ -296,14 +296,16 @@ In this (and only this) situation, the simple solution is to copy a clone of the
296296
The `git clone` should reside within the Dockerfile folder.
297297
Then the Dockerfile section can look like the following:
298298

299-
# copy the repo
300-
COPY my_private_repo /opt/my_private_repo
299+
```
300+
# copy the repo
301+
COPY my_private_repo /opt/my_private_repo
301302
302-
# manually install dependencies
303-
RUN R -q -e 'install.packages("remotes", dependencies = TRUE)'
303+
# manually install dependencies
304+
RUN R -q -e 'install.packages("remotes", dependencies = TRUE)'
304305
305-
# install package from folder
306-
RUN R -q -e 'install.packages("/opt/my_private_repo", repos = NULL, type = "source", dependencies = TRUE)'
306+
# install package from folder
307+
RUN R -q -e 'install.packages("/opt/my_private_repo", repos = NULL, type = "source", dependencies = TRUE)'
308+
```
307309

308310
This way of handling private repositories [seems to be good practice](https://stackoverflow.com/questions/23391839/clone-private-git-repo-with-dockerfile/55761914#55761914), for being simple, secure, and generally most feasible.
309311

content/tutorials/development_containers1/index.qmd

+5-5
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Either way, note that you need to run the docker app or docker in a terminal *as
147147
More info about the installation on your specific Linux operation systems [can be found here](https://docs.docker.com/engine/install).
148148
The procedure for Debian or Ubuntu-based distributions involves trusting dockers gpg keys and adding an extra repository, [some caution is warranted](https://wiki.debian.org/DontBreakDebian).
149149

150-
```{sh}
150+
```sh
151151
#| eval: false
152152
sudo apt update && sudo apt install docker-ce docker-buildx-plugin # debian-based
153153
# sudo pacman -Sy docker docker-buildx # Arch Linux
@@ -162,7 +162,7 @@ Many features which you would take for granted in this kind of software (securit
162162
For users to be able to use Docker, they must be in the "docker" group.
163163
(Insert your username at `<your-username>`.)
164164

165-
```{sh}
165+
```sh
166166
#| eval: false
167167
sudo usermod -a -G docker <your-username>
168168
```
@@ -178,7 +178,7 @@ However, due to [diverse](https://docs.docker.com/engine/security) [security](ht
178178

179179
On a `systemd` system, you can start and stop Docker on demand via the following commands (those will ask you for `sudo` authentification if necessary).
180180

181-
```{sh}
181+
```sh
182182
#| eval: false
183183
systemctl start docker
184184

@@ -195,7 +195,7 @@ For aficionados: docker actually runs multiple services: the docker service, the
195195

196196
You can check the Docker installation by confirming the version at which the service is running.
197197

198-
```{sh}
198+
```sh
199199
#| eval: false
200200
docker --version
201201
```
@@ -328,7 +328,7 @@ In this (and only this) situation, the simple solution is to copy a clone of the
328328
The `git clone` should reside within the Dockerfile folder.
329329
Then the Dockerfile section can look like the following:
330330

331-
```{}
331+
```
332332
# copy the repo
333333
COPY my_private_repo /opt/my_private_repo
334334

content/tutorials/development_containers2_run/index.qmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ benchmark(test())
157157

158158
In the terminal:
159159

160-
```{}
160+
```
161161
test replications elapsed relative user.self sys.self user.child sys.child
162162
1 test() 100 22.391 1 83.961 65.291 0 0
163163
```
164164

165165
In the container:
166166

167-
```{}
167+
```
168168
test replications elapsed relative user.self sys.self user.child sys.child
169169
1 test() 100 26.076 1 102.494 153.89 0 0
170170
```

content/tutorials/development_containers3_build/index.md

+42-38
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,22 @@ The Dockerfile resides in your working folder (yet it also defines a [`WORKDIR`]
104104

105105
<!-- -->
106106

107-
# Use the official Python image (Alpine Linux, Python 3)
108-
FROM python:3-alpine
107+
```
108+
# Use the official Python image (Alpine Linux, Python 3)
109+
FROM python:3-alpine
109110
110-
# install app dependencies
111-
RUN apk update && apk add --no-cache python3 py3-pip
112-
RUN pip install flask
111+
# install app dependencies
112+
RUN apk update && apk add --no-cache python3 py3-pip
113+
RUN pip install flask
113114
114-
# install app
115-
COPY hello.py /
115+
# install app
116+
COPY hello.py /
116117
117-
# final configuration
118-
ENV FLASK_APP=hello
119-
EXPOSE 8000
120-
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]
118+
# final configuration
119+
ENV FLASK_APP=hello
120+
EXPOSE 8000
121+
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]
122+
```
121123

122124
Note that the following `hello.py` file needs to be present in your working directory (you will be reminded by a friendly error message):
123125

@@ -132,7 +134,7 @@ def hello():
132134

133135
With the `Dockerfile` and `hello.py` in place, you can build the container [^2].
134136

135-
``` {sh}
137+
``` sh
136138
#| eval: false
137139
# on Windows, you are already in an administrator terminal
138140
docker build --pull -t my-flask .
@@ -156,7 +158,7 @@ You should now see a `python` image, which is the base alpine image we built upo
156158
There is also a `my-flask`.
157159
Try it!
158160

159-
``` {sh}
161+
``` sh
160162
#| eval: false
161163
docker run my-flask
162164
```
@@ -208,36 +210,38 @@ They prepared quite [a lot of useful images](https://hub.docker.com/u/rocker), i
208210

209211
Note the syntax in `FROM`: it is `rocker/<image>:<version>`.
210212

211-
FROM rocker/rstudio:latest
212-
# (Use the rocker rstudio image)
213+
```
214+
FROM rocker/rstudio:latest
215+
# (Use the rocker rstudio image)
213216
214-
# update the system packages
215-
RUN apt update \
216-
&& apt upgrade --yes
217+
# update the system packages
218+
RUN apt update \
219+
&& apt upgrade --yes
217220
218-
# git2rdata requires git
219-
RUN apt-get update \
220-
&& apt-get install -y --no-install-recommends \
221-
git libgit2-dev\
222-
&& apt-get clean
221+
# git2rdata requires git
222+
RUN apt-get update \
223+
&& apt-get install -y --no-install-recommends \
224+
git libgit2-dev\
225+
&& apt-get clean
223226
224-
# update pre-installed R packages
225-
# RUN Rscript -e 'update.packages(ask=FALSE)'
227+
# update pre-installed R packages
228+
# RUN Rscript -e 'update.packages(ask=FALSE)'
226229
227-
# copy a `.Rprofile` to the container
228-
# available here: https://tutorials.inbo.be/installation/administrator/admin_install_r/Rprofile.site
229-
COPY docker/.Rprofile $R_HOME/etc/Rprofile.site
230+
# copy a `.Rprofile` to the container
231+
# available here: https://tutorials.inbo.be/installation/administrator/admin_install_r/Rprofile.site
232+
COPY docker/.Rprofile $R_HOME/etc/Rprofile.site
230233
231-
# install package via an R command (`R -q -e` or `Rscript -e`)
232-
# (a) from pre-configured repositories
233-
RUN Rscript -e 'install.packages("git2rdata")'
234+
# install package via an R command (`R -q -e` or `Rscript -e`)
235+
# (a) from pre-configured repositories
236+
RUN Rscript -e 'install.packages("git2rdata")'
234237
235-
# (b) via r-universe
236-
RUN R -q -e 'install.packages("watina", repos = c(inbo = "https://inbo.r-universe.dev", CRAN = "https://cloud.r-project.org"))'
238+
# (b) via r-universe
239+
RUN R -q -e 'install.packages("watina", repos = c(inbo = "https://inbo.r-universe.dev", CRAN = "https://cloud.r-project.org"))'
237240
238-
# (b) from github
239-
RUN R -q -e 'install.packages("remotes")'
240-
RUN R -q -e 'remotes::install_github("inbo/INBOmd", dependencies = TRUE)'
241+
# (b) from github
242+
RUN R -q -e 'install.packages("remotes")'
243+
RUN R -q -e 'remotes::install_github("inbo/INBOmd", dependencies = TRUE)'
244+
```
241245

242246
It takes some puzzle work to get the dependencies right, e.g. with the `libgit2` dependency (try commenting out that line to get a feeling for build failure).
243247
However, there is hope: (i) the error output is quite instructive (at least for Linux users), (ii) building is incremental, so you can add successively.
@@ -255,14 +259,14 @@ More here: <https://docs.docker.com/build/building/best-practices>
255259

256260
Test the image:
257261

258-
``` {sh}
262+
``` sh
259263
#| eval: false
260264
docker build -t test-rstudio .
261265
```
262266

263267
Run it, as before:
264268

265-
``` {sh}
269+
``` sh
266270
#| eval: false
267271
docker run --rm -p 8787:8787 -e PASSWORD=YOURNEWPASSWORD test-rstudio
268272
```

content/tutorials/development_containers3_build/index.qmd

+7-7
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The Dockerfile resides in your working folder (yet it also defines a [`WORKDIR`]
113113
- Edit the file in your favorite text editor (`vim Dockerfile`; Windows users probably use "notepad").
114114
- Paste and optionally modify the content below.
115115

116-
```{}
116+
```
117117
# Use the official Python image (Alpine Linux, Python 3)
118118
FROM python:3-alpine
119119
@@ -133,7 +133,7 @@ CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]
133133

134134
Note that the following `hello.py` file needs to be present in your working directory (you will be reminded by a friendly error message):
135135

136-
```{python}
136+
```python
137137
#| eval: false
138138
from flask import Flask
139139
app = Flask(__name__)
@@ -146,7 +146,7 @@ def hello():
146146

147147
With the `Dockerfile` and `hello.py` in place, you can build the container [^4].
148148

149-
```{sh}
149+
```sh
150150
#| eval: false
151151
# on Windows, you are already in an administrator terminal
152152
docker build --pull -t my-flask .
@@ -171,7 +171,7 @@ You should now see a `python` image, which is the base alpine image we built upo
171171
There is also a `my-flask`.
172172
Try it!
173173

174-
```{sh}
174+
```sh
175175
#| eval: false
176176
docker run my-flask
177177
```
@@ -229,7 +229,7 @@ They prepared quite [a lot of useful images](https://hub.docker.com/u/rocker), i
229229

230230
Note the syntax in `FROM`: it is `rocker/<image>:<version>`.
231231

232-
```{}
232+
```
233233
FROM rocker/rstudio:latest
234234
# (Use the rocker rstudio image)
235235
@@ -280,15 +280,15 @@ More here: <https://docs.docker.com/build/building/best-practices>
280280

281281
Test the image:
282282

283-
```{sh}
283+
```sh
284284
#| eval: false
285285
docker build -t test-rstudio .
286286
```
287287

288288

289289
Run it, as before:
290290

291-
```{sh}
291+
```sh
292292
#| eval: false
293293
docker run --rm -p 8787:8787 -e PASSWORD=YOURNEWPASSWORD test-rstudio
294294
```

content/tutorials/development_containers4_podman/index.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ I follow the `podman` installation instructions for Arch Linux, to set up a **ro
7373

7474
Installation:
7575

76-
``` {sh}
76+
``` sh
7777
#| eval: false
7878
pacman -Sy podman podman-docker passt
7979
```
@@ -87,23 +87,23 @@ Just to be safe, I briefly list the major configuration steps.
8787

8888
The first step is to confirm a required kernel module: check that `unpriviledged_users_clone` is set to one.
8989

90-
``` {sh}
90+
``` sh
9191
#| eval: false
9292
sysctl kernel.unprivileged_userns_clone
9393
```
9494

9595
Then, configure "subordinate user IDs".
9696
There are detail differences in each Linux distribution; with some luck, your username is already present in these lists:
9797

98-
``` {sh}
98+
``` sh
9999
#| eval: false
100100
cat /etc/subuid
101101
cat /etc/subgid
102102
```
103103

104104
If not, you can be admitted to the club of subordinates with the command:
105105

106-
``` {sh}
106+
``` sh
107107
#| eval: false
108108
usermod --add-subuids 100000-165535 --add-subgids 100000-165535 <username>
109109
podman system migrate
@@ -112,7 +112,7 @@ podman system migrate
112112
We note some useful commands on the way: `podman system ...` and `podman info`.
113113
You might immediately check "native rootless overlays" (has something to do with mounting filesystems in the container):
114114

115-
``` {sh}
115+
``` sh
116116
#| eval: false
117117
podman info | grep -i overlay
118118
```
@@ -127,7 +127,7 @@ You can use images from `docker.io` with Podman.
127127
The only difference from Docker is the explicit mention of the source, `docker.io`.
128128
For example:
129129

130-
``` {sh}
130+
``` sh
131131
#| eval: false
132132
podman search docker.io/alpine
133133
podman pull docker.io/alpine # download a machine
@@ -141,7 +141,7 @@ Except for the prefix, everything you [can read in our `docker run` tutorial](..
141141

142142
Note that at least some `docker.io` images will not work: I actually experienced issues with the "rootless Docker image":
143143

144-
``` {sh}
144+
``` sh
145145
#| eval: false
146146
# podman run --rm -it docker.io/docker:25.0-dind-rootless
147147
```
@@ -162,7 +162,7 @@ Any Dockerfile should work, with the mentioned mini-adjustment to `FROM`.
162162
And you can use any Docker image; `docker.io/rocker/rstudio` [is available](https://rocker-project.org/use/rootless-podman.html) (don't forget to specify the port).
163163
You may even write `docker` in the terminal: it will alias to `podman` (via the `podman-docker` package on Linux, or an alias).
164164

165-
``` {sh}
165+
``` sh
166166
#| eval: false
167167
podman run --rm -p 8787:8787 -e PASSWORD=YOURNEWPASSWORD -v /data/git/coding-club:/root/coding-club docker.io/rocker/rstudio
168168
```

0 commit comments

Comments
 (0)