Reputation: 101
Hi guys I am new to Docker, I build an image based on the TensorFlow image to run jupyterlab instead of jupyter notebook.
And I would like to pass a password to the jupyterlab environment instead of the randomly generated token, everything works fine when i run this commend from the container exec:
jupyter-lab --ip=0.0.0.0 --NotebookApp.token='123456789' --NotebookApp.password='123456789' --port=8888 --no-browser --allow-root
However, I am trying to dynamically pass each time a password with the docker run command. This is my Dockerfile:
FROM tensorflow/tensorflow:nightly-gpu-jupyter
RUN apt-get update
RUN pip install jupyterlab
ENV pwd="123456789"
ENTRYPOINT ["jupyter-lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root", '--NotebookApp.token=${pwd}','--NotebookApp.password=${pwd}']
And this the command that I am trying to run:
docker run -it -p 8888:8888 km/jupyterlab:0.4 -e pwd='azerty123'
I get this error:
-e: [jupyter-lab,: command not found
What I am doing wrong and how can I pass the password when I run the image?
Thank you in advance.
Upvotes: 2
Views: 743
Reputation: 569
The "exec form" of entrypoint doesn't support environment variables. If you want to use environment variables, you should use the "shell form" entrypoint.
From your example, it'd look something like this:
ENTRYPOINT exec jupyter-lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token="$pwd" --NotebookApp.password="$pwd"
Docs: https://docs.docker.com/engine/reference/builder/#shell-form-entrypoint-example
Other relevant SO answer: https://stackoverflow.com/a/37904830/399007
Upvotes: 1