Skip to content

Commit e73d308

Browse files
authored
Fix building images on aarch64 Macs while using Rosetta (#2298)
1 parent 3880664 commit e73d308

File tree

9 files changed

+76
-0
lines changed

9 files changed

+76
-0
lines changed

images/all-spark-notebook/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ RUN apt-get update --yes && \
2525
gcc && \
2626
apt-get clean && rm -rf /var/lib/apt/lists/*
2727

28+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
29+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
30+
#
31+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
32+
RUN rm -rf "/home/${NB_USER}/.cache/"
33+
2834
USER ${NB_UID}
2935

3036
# R packages including IRKernel which gets installed globally.

images/base-notebook/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ RUN apt-get update --yes && \
2929
run-one && \
3030
apt-get clean && rm -rf /var/lib/apt/lists/*
3131

32+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
33+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
34+
#
35+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
36+
RUN rm -rf "/home/${NB_USER}/.cache/"
37+
3238
USER ${NB_UID}
3339

3440
# Install JupyterHub, JupyterLab, NBClassic and Jupyter Notebook
@@ -74,6 +80,12 @@ RUN fix-permissions /etc/jupyter/
7480
HEALTHCHECK --interval=3s --timeout=1s --start-period=3s --retries=3 \
7581
CMD /etc/jupyter/docker_healthcheck.py || exit 1
7682

83+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
84+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
85+
#
86+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
87+
RUN rm -rf "/home/${NB_USER}/.cache/"
88+
7789
# Switch back to jovyan to avoid accidental container runs as root
7890
USER ${NB_UID}
7991

images/datascience-notebook/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ ENV JULIA_DEPOT_PATH=/opt/julia \
2929
# Setup Julia
3030
RUN /opt/setup-scripts/setup_julia.py
3131

32+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
33+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
34+
#
35+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
36+
# hadolint ignore=DL3059
37+
RUN rm -rf "/home/${NB_USER}/.cache/"
38+
3239
USER ${NB_UID}
3340

3441
# Setup IJulia kernel & other packages

images/docker-stacks-foundation/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \
8686
fix-permissions "${CONDA_DIR}" && \
8787
fix-permissions "/home/${NB_USER}"
8888

89+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
90+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
91+
#
92+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
93+
RUN rm -rf "/home/${NB_USER}/.cache/"
94+
8995
USER ${NB_UID}
9096

9197
# Pin the Python version here, or set it to "default"
@@ -152,6 +158,12 @@ RUN mkdir /usr/local/bin/start-notebook.d && \
152158

153159
COPY 10activate-conda-env.sh /usr/local/bin/before-notebook.d/
154160

161+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
162+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
163+
#
164+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
165+
RUN rm -rf "/home/${NB_USER}/.cache/"
166+
155167
# Switch back to jovyan to avoid accidental container runs as root
156168
USER ${NB_UID}
157169

images/julia-notebook/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ ENV JULIA_DEPOT_PATH=/opt/julia \
2121
# Setup Julia
2222
RUN /opt/setup-scripts/setup_julia.py
2323

24+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
25+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
26+
#
27+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
28+
# hadolint ignore=DL3059
29+
RUN rm -rf "/home/${NB_USER}/.cache/"
30+
2431
USER ${NB_UID}
2532

2633
# Setup IJulia kernel & other packages

images/minimal-notebook/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ RUN apt-get update --yes && \
4040
# Create alternative for nano -> nano-tiny
4141
RUN update-alternatives --install /usr/bin/nano nano /bin/nano-tiny 10
4242

43+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
44+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
45+
#
46+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
47+
# hadolint ignore=DL3059
48+
RUN rm -rf "/home/${NB_USER}/.cache/"
49+
4350
# Switch back to jovyan to avoid accidental container runs as root
4451
USER ${NB_UID}
4552

images/pyspark-notebook/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ RUN /opt/setup-scripts/setup_spark.py \
5151
COPY ipython_kernel_config.py "/etc/ipython/"
5252
RUN fix-permissions "/etc/ipython/"
5353

54+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
55+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
56+
#
57+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
58+
# hadolint ignore=DL3059
59+
RUN rm -rf "/home/${NB_USER}/.cache/"
60+
5461
USER ${NB_UID}
5562

5663
# Install pyarrow

images/r-notebook/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ RUN apt-get update --yes && \
2424
gcc && \
2525
apt-get clean && rm -rf /var/lib/apt/lists/*
2626

27+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
28+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
29+
#
30+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
31+
RUN rm -rf "/home/${NB_USER}/.cache/"
32+
2733
USER ${NB_UID}
2834

2935
# R packages including IRKernel which gets installed globally.

images/scipy-notebook/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ RUN apt-get update --yes && \
2424
ffmpeg && \
2525
apt-get clean && rm -rf /var/lib/apt/lists/*
2626

27+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
28+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
29+
#
30+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
31+
RUN rm -rf "/home/${NB_USER}/.cache/"
32+
2733
USER ${NB_UID}
2834

2935
# Install Python 3 packages
@@ -74,6 +80,12 @@ RUN git clone https://github.com/PAIR-code/facets && \
7480
RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \
7581
fix-permissions "/home/${NB_USER}"
7682

83+
# macOS Rosetta virtualization creates junk directory which gets owned by root further up.
84+
# It'll get re-created, but as USER runner after the next directive so hopefully should not cause permission issues.
85+
#
86+
# More info: https://github.com/jupyter/docker-stacks/issues/2296
87+
RUN rm -rf "/home/${NB_USER}/.cache/"
88+
7789
USER ${NB_UID}
7890

7991
WORKDIR "${HOME}"

0 commit comments

Comments
 (0)