Skip to content

Commit fee7942

Browse files
authored
Merge pull request #837 from vilhelmen/manpage_recipes
Manpage recipe
2 parents e1432be + e90e0c0 commit fee7942

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

docs/using/recipes.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,57 @@ If you are mounting a host directory as `/home/jovyan/work` in your container an
121121

122122
Ref: [https://github.com/jupyter/docker-stacks/issues/199](https://github.com/jupyter/docker-stacks/issues/199)
123123

124+
## Manpage installation
125+
126+
Most containers, including our Ubuntu base image, ship without manpages installed to save space. You can use the following dockerfile to inherit from one of our images to enable manpages:
127+
128+
```dockerfile
129+
# Choose your desired base image
130+
ARG BASE_CONTAINER=jupyter/datascience-notebook:latest
131+
FROM $BASE_CONTAINER
132+
133+
USER root
134+
135+
# Remove the manpage blacklist, install man, install docs
136+
RUN rm /etc/dpkg/dpkg.cfg.d/excludes \
137+
&& apt-get update \
138+
&& dpkg -l | grep ^ii | cut -d' ' -f3 | xargs apt-get install -yq --no-install-recommends --reinstall man \
139+
&& apt-get clean \
140+
&& rm -rf /var/lib/apt/lists/*
141+
142+
# Workaround for a mandb bug, should be fixed in mandb > 2.8.5
143+
# https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=8197d7824f814c5d4b992b4c8730b5b0f7ec589a
144+
RUN echo "MANPATH_MAP ${CONDA_DIR}/bin ${CONDA_DIR}/man" >> /etc/manpath.config \
145+
&& echo "MANPATH_MAP ${CONDA_DIR}/bin ${CONDA_DIR}/share/man" >> /etc/manpath.config \
146+
&& mandb
147+
148+
USER $NB_UID
149+
```
150+
151+
Adding the documentation on top of an existing singleuser image wastes a lot of space and requires reinstalling every system package, which can take additional time and bandwidth; the `datascience-notebook` image has been shown to grow by almost 3GB when adding manapages in this way. Enabling manpages in the base Ubuntu layer prevents this container bloat:
152+
153+
```Dockerfile
154+
# Ubuntu 18.04 (bionic) from 2018-05-26
155+
# https://github.com/docker-library/official-images/commit/aac6a45b9eb2bffb8102353c350d341a410fb169
156+
ARG BASE_CONTAINER=ubuntu:bionic-20180526@sha256:c8c275751219dadad8fa56b3ac41ca6cb22219ff117ca98fe82b42f24e1ba64e
157+
FROM $BASE_CONTAINER
158+
159+
ENV DEBIAN_FRONTEND noninteractive
160+
# Remove the manpage blacklist, install man, install docs
161+
RUN rm /etc/dpkg/dpkg.cfg.d/excludes \
162+
&& apt-get update \
163+
&& dpkg -l | grep ^ii | cut -d' ' -f3 | xargs apt-get install -yq --no-install-recommends --reinstall man \
164+
&& apt-get clean \
165+
&& rm -rf /var/lib/apt/lists/*
166+
167+
# Workaround for a mandb bug, should be fixed in mandb > 2.8.5
168+
# https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=8197d7824f814c5d4b992b4c8730b5b0f7ec589a
169+
RUN echo "MANPATH_MAP /opt/conda/bin /opt/conda/man" >> /etc/manpath.config \
170+
&& echo "MANPATH_MAP /opt/conda/bin /opt/conda/share/man" >> /etc/manpath.config
171+
```
172+
173+
Be sure to check the current base image in `base-notebook` before building.
174+
124175
## JupyterHub
125176

126177
We also have contributed recipes for using JupyterHub.

0 commit comments

Comments
 (0)