Adding config file in docker run command -
this docker command works expected:
docker run -i -t -p 7778:8888 continuumio/miniconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root"
it starts miniconda python 3 version installed. problem generates random password access jupyter when go ...
and there no way change password. way create or update config file jupyter_notebook_config.py found in home directory (sub-folder: ~/.jupyter) how save file on host , mount using -v parameter?
i can manually if follow these 3 steps:
1) login ipython docker container
docker exec -it 6cbc bash
2) run following command...
jupyter notebook --generate-config
3) copy config file container using command this...
docker cp ipython_kernel_config.py 6cbc8d829e4a:/.jupyter/jupyter_notebook_config.py
i looking way merge these 3 steps docker run command.
have tried adding volume mount run command?
something this.
docker run -i -t -v /tmp/.jupyter:/.jupyter/ -p 7778:8888 continuumio/miniconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root"
this assumes have /tmp/.jupyter
directory, , feel free change else.
also, messy command, reason why don't create own image using dockerfile? here rough example, haven't tested typos , syntax errors, idea.
from continuumio/miniconda3 run /opt/conda/bin/conda install jupyter -y --quiet run mkdir /opt/notebooks # copy in custom config copy ipython_kernel_config.py /.jupyter/jupyter_notebook_config.py expose 8888 # run notebook cmd ["/opt/conda/bin/jupyter", "notebook", "--notebook-dir=/opt/notebooks", "--ip='*'", "--port=8888", "--no-browser", "--allow-root"]
to build , run this.
docker build -t myminiconda3 . docker run -it -p 7778:8888 myminiconda3
you can mount in local files if want.
docker run -it -v `pwd`:/mycode -p 7778:8888 myminiconda3
and run daemon
docker run -d -v `pwd`:/mycode -p 7778:8888 myminiconda3
Comments
Post a Comment