Skip to content

Instantly share code, notes, and snippets.

@Sogl
Last active November 1, 2023 10:10
Show Gist options
  • Save Sogl/d154e1b1f421d2da4baae0fb41b1d278 to your computer and use it in GitHub Desktop.
Save Sogl/d154e1b1f421d2da4baae0fb41b1d278 to your computer and use it in GitHub Desktop.
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
# Do not print anything if this is not being used interactively
[ -z "$PS1" ] && return
# Set up attractive prompt
export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > "
export TERM=xterm-256color
alias grep="grep --color=auto"
alias ls="ls --color=auto"
echo -e "\e[1;31m"
cat<<TF
________ _______________
___ __/__________________________________ ____/__ /________ __
__ / _ _ \_ __ \_ ___/ __ \_ ___/_ /_ __ /_ __ \_ | /| / /
_ / / __/ / / /(__ )/ /_/ / / _ __/ _ / / /_/ /_ |/ |/ /
/_/ \___//_/ /_//____/ \____//_/ /_/ /_/ \____/____/|__/
TF
echo -e "\e[0;33m"
if [[ $EUID -eq 0 ]]; then
cat <<WARN
WARNING: You are running this container as root, which can cause new files in
mounted volumes to be created as the root user on your host machine.
To avoid this, run the container by specifying your user's userid:
$ docker run -u \$(id -u):\$(id -g) args...
WARN
else
cat <<EXPL
You are running this container as user with ID $(id -u) and group $(id -g),
which should map to the ID and group for your user on the Docker host. Great!
EXPL
fi
# Turn off colors
echo -e "\e[m"
# Fix CUDA loading for running nvidia-smi
ldconfig
# My custom
echo -e "TEST"
sh -c "jupyter notebook --generate-config &&
echo \"c.ServerApp.allow_origin = '*'\" >> /root/.jupyter/jupyter_notebook_config.py &&
echo \"c.ServerApp.allow_remote_access = True\" >> /root/.jupyter/jupyter_notebook_config.py &&
echo \"c.NotebookApp.password = u'sha1:fd40b23609dd:882af6cdf722657245be6f4abd9b641a84ef9c2a'\" >> /root/.jupyter/jupyter_notebook_config.py"
version: '1.0'
services:
tensorflow:
image: tensorflow/tensorflow:latest-jupyter
ports:
- 8888:8888
volumes:
- ./bash.bashrc:/etc/bash.bashrc
- .:/tf/my-files
# command: >
# sh -c "jupyter notebook --generate-config &&
# echo \"c.ServerApp.allow_origin = '*'\" >> /root/.jupyter/jupyter_notebook_config.py &&
# echo \"c.ServerApp.allow_remote_access = True\" >> /root/.jupyter/jupyter_notebook_config.py &&
# echo \"c.NotebookApp.password = u'sha1:fd40b23609dd:882af6cdf722657245be6f4abd9b641a84ef9c2a'\" >> /root/.jupyter/jupyter_notebook_config.py &&
# jupyter notebook --allow-root --port=8888"
# command: "start-notebook.sh --NotebookApp.token='' --NotebookApp.password=''"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment