Skip to content

Commit 40272b1

Browse files
committed
Restore jupyterhub-singleuser as the default command
update docs to explain explicit `cmd: null` use case
1 parent 9653da6 commit 40272b1

File tree

3 files changed

+33
-19
lines changed

3 files changed

+33
-19
lines changed

docs/source/jupyterhub/customizing/user-environment.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ image containing useful tools and libraries for data science, complete these ste
4444
# https://github.com/jupyter/docker-stacks/tree/HEAD/datascience-notebook/Dockerfile
4545
name: jupyter/datascience-notebook
4646
tag: latest
47+
# `cmd: null` allows the custom CMD of the Jupyter docker-stacks to be used
48+
# which performs further customization on startup.
49+
cmd: null
4750
```
4851
4952
```{note}
@@ -244,10 +247,9 @@ FROM jupyter/minimal-notebook:latest
244247
RUN pip install --no-cache-dir astropy
245248

246249
# set the default command of the image,
247-
# if the parent image will not launch a jupyterhub singleuser server.
248-
# The JupyterHub "Docker stacks" do not need to be overridden.
249-
# Set either here or in `singleuser.cmd` in your values.yaml
250-
# CMD ["jupyterhub-singleuser"]
250+
# if you want to launch more complex startup than the default `juptyerhub-singleuser`.
251+
# To launch an image's custom CMD instead of the default `jupyterhub-singleuser`
252+
# set `singleuser.cmd: null` in your config.yaml.
251253
```
252254

253255
```{note}
@@ -529,25 +531,33 @@ this is best done in the ENTRYPOINT of the image,
529531
and not in the CMD, so that overriding the command does not skip your preparation.
530532
```
531533

532-
By default, zero-to-jupyterhub will launch the default CMD that is specified in your chosen image,
533-
respecting any startup customization that image may have.
534-
If the image doesn't launch `jupyterhub-singleuser` by default,
535-
you will additionally need to specify `singleuser.cmd`
536-
in your `values.yaml` as the command to launch,
537-
so that it ultimately launches `jupyterhub-singleuser`.
538-
The simplest version:
534+
By default, zero-to-jupyterhub will launch the command `jupyterhub-singleuser`.
535+
If you have an image (such as `jupyter/scipy-notebook` and other Jupyter Docker stacks)
536+
that defines a CMD with startup customization and ultimately launches `jupyterhub-singleuser`,
537+
you can chose to launch the image's default CMD instead by setting:
539538

540539
```yaml
541540
singleuser:
542-
cmd: jupyterhub-singleuser
541+
cmd: null
543542
```
544543
545-
```{versionchanged} 2.0
546-
Prior to 2.0, the default behavior of zero-to-jupyterhub was to launch `jupyterhub-singleuser` explicitly,
547-
ignoring what was in the image.
548-
The default command is now whatever the image runs by default.
544+
Alternately, you can specify an explicit custom command as a string or list of strings:
545+
546+
```yaml
547+
singleuser:
548+
cmd:
549+
- /usr/local/bin/custom-command
550+
- "--flag"
551+
- "--other-flag"
549552
```
550553
554+
:::{note}
555+
Docker has `ENTRYPOINT` and `CMD`,
556+
which k8s calls `command` and `args`.
557+
zero-to-jupyterhub always respects the ENTRYPOINT of the image,
558+
and setting `singleuser.cmd` only overrides the CMD.
559+
:::
560+
551561
## Disable specific JupyterLab extensions
552562

553563
Sometimes you want to temporarily disable a JupyterLab extension on a JupyterHub

jupyterhub/schema.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ properties:
10191019
extraPorts:
10201020
type: array
10211021
description: |
1022-
Extra ports to add to the Hub Service object besides `hub` / `8081`.
1022+
Extra ports to add to the Hub Service object besides `hub` / `8081`.
10231023
This should be an array that includes `name`, `port`, and `targetPort`.
10241024
See [Multi-port Services](https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services) for more details.
10251025
loadBalancerIP:
@@ -2124,6 +2124,10 @@ properties:
21242124
description: |
21252125
Passthrough configuration for
21262126
[KubeSpawner.cmd](https://jupyterhub-kubespawner.readthedocs.io/en/latest/spawner.html#kubespawner.KubeSpawner.cmd).
2127+
The default is "jupyterhub-singleuser".
2128+
Use `cmd: null` to launch a custom CMD from the image,
2129+
which must launch jupyterhub-singleuser eventually.
2130+
For example: Jupyter's docker-stacks images.
21272131
defaultUrl:
21282132
type: [string, "null"]
21292133
description: |
@@ -2636,7 +2640,7 @@ properties:
26362640
description: |
26372641
The path type to use. The default value is 'Prefix'.
26382642
2639-
See [the Kubernetes documentation](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types)
2643+
See [the Kubernetes documentation](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types)
26402644
for more details about path types.
26412645
tls:
26422646
type: array

jupyterhub/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ singleuser:
394394
extraResource:
395395
limits: {}
396396
guarantees: {}
397-
cmd:
397+
cmd: jupyterhub-singleuser
398398
defaultUrl:
399399
extraPodConfig: {}
400400
profileList: []

0 commit comments

Comments
 (0)