diff --git a/docker/Dockerfile b/docker/Dockerfile index a8fafa0..bfccb99 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,20 +9,19 @@ RUN apt-get update && apt-get upgrade -y \ && rm -rf /var/lib/apt/lists/* RUN conda install -y -c conda-forge \ - tensorflow=1.0.0 \ + tensorflow \ jupyter_contrib_nbextensions ARG username ARG userid +ARG home=/home/${username} +ARG workdir=${home}/handson-ml + RUN adduser ${username} --uid ${userid} --gecos '' --disabled-password \ && echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} \ && chmod 0440 /etc/sudoers.d/${username} -ENV HOME /home/${username} - -ARG workdir=${HOME}/handson-ml - WORKDIR ${workdir} RUN chown ${username}:${username} ${workdir} @@ -58,7 +57,7 @@ COPY docker/nbdime-*.patch /tmp/ USER root WORKDIR / RUN patch -d /opt/conda/lib/python3.6/site-packages -p1 --forward --reject-file=- < \ - /tmp/nbdime-2-toc.patch || true \ + /tmp/nbdime-1-details.patch || true \ && patch -d /opt/conda/lib/python3.6/site-packages -p1 --forward --reject-file=- < \ /tmp/nbdime-2-toc.patch || true RUN rm /tmp/nbdime-*.patch @@ -67,7 +66,7 @@ WORKDIR ${workdir} COPY docker/bashrc /tmp/bashrc -RUN cat /tmp/bashrc >> ${HOME}/.bashrc +RUN cat /tmp/bashrc >> ${home}/.bashrc RUN sudo rm /tmp/bashrc # INFO: Uncomment the RUN command below to disable git diff paging @@ -81,6 +80,6 @@ RUN sudo rm /tmp/bashrc # from notebook.auth import passwd # passwd() # and take the hash from the output -#RUN mkdir -p ${HOME}/.jupyter && \ +#RUN mkdir -p ${home}/.jupyter && \ # echo 'c.NotebookApp.password = u"sha1:c6bbcba2d04b:f969e403db876dcfbe26f47affe41909bd53392e"' \ -# >> ${HOME}/.jupyter/jupyter_notebook_config.py +# >> ${home}/.jupyter/jupyter_notebook_config.py diff --git a/docker/README.md b/docker/README.md index 2355c45..037ae22 100644 --- a/docker/README.md +++ b/docker/README.md @@ -32,7 +32,9 @@ You can close the server just by pressing `Ctrl-C` in terminal window. Run `make exec` (or `docker-compose exec handson-ml bash`) while the server is running to run an additional `bash` shell inside the `handson-ml` container. Now you're inside the environment prepared within the image. -One of the usefull things that can be done there may be comparing versions of the notebooks using the `nbdiff` command if you haven't got `nbdime` installed locally (it is **way** better than plain `diff` for notebooks). See [Tools for diffing and merging of Jupyter notebooks](https://github.com/jupyter/nbdime) for more details. +One of the usefull things that can be done there would be starting TensorBoard (for example with simple `tb` command, see bashrc file). + +Another one may be comparing versions of the notebooks using the `nbdiff` command if you haven't got `nbdime` installed locally (it is **way** better than plain `diff` for notebooks). See [Tools for diffing and merging of Jupyter notebooks](https://github.com/jupyter/nbdime) for more details. You can see changes you made relative to the version in git using `git diff` which is integrated with `nbdiff`. diff --git a/docker/bashrc b/docker/bashrc index b1bce45..619677d 100644 --- a/docker/bashrc +++ b/docker/bashrc @@ -10,3 +10,9 @@ nbd() { # echo "How change $CHECKPOINT_COPY into $WORKING_COPY" nbdiff "$CHECKPOINT_COPY" "$WORKING_COPY" --ignore-details } + +tb() { + python -m tensorboard.main --logdir=tf_logs +} + +alias tensorboard="python -m tensorboard.main" diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8a9718c..d4b46e4 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,6 +15,7 @@ services: max-size: 50m ports: - "8888:8888" + - "6006:6006" volumes: - ../:/home/devel/handson-ml command: /opt/conda/bin/jupyter notebook --ip='*' --port=8888 --no-browser