├── README.md └── Dockerfile /README.md: -------------------------------------------------------------------------------- 1 | # dl_remote 2 | 3 | ## Usage 4 | 5 | ``` 6 | $ ssh foo@bar -L 5999:localhost:5999 -L 8888:localhost:8888 7 | $ docker run --gpus all -it --net=host --name dl_remote naruya/dl_remote:cuda-11.8 8 | 9 | % vnc # start x11vnc (optional) 10 | % jup # jupyter lab (optional) 11 | 12 | # activate python environment 13 | % source ~/venv/work/bin/activate 14 | % python -c "import torch; print(torch.cuda.is_available())" 15 | ``` 16 | 17 | ## Test 18 | 19 | ### vnc 20 | ``` 21 | % apt install x11-apps mesa-utils 22 | % vnc # start x11vnc 23 | % xeyes # cpu rendering 24 | % glxgears # gpu rendering 25 | ``` 26 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nvidia/cuda:11.8.0-devel-ubuntu20.04 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | 4 | 5 | # zsh 6 | RUN apt-get update && apt-get install -y wget git zsh 7 | SHELL ["/bin/zsh", "-c"] 8 | RUN wget http://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh 9 | RUN sed -i "s/# zstyle ':omz:update' mode disabled/zstyle ':omz:update' mode disabled/g" ~/.zshrc 10 | 11 | # python (latest version) 12 | RUN apt-get update && \ 13 | apt-get install -y software-properties-common && \ 14 | add-apt-repository ppa:deadsnakes/ppa 15 | RUN apt-get update && apt-get install -y python3.10 python3.10-dev python3.10-venv python3-pip 16 | RUN ln -s /usr/bin/python3.10 /usr/bin/python 17 | 18 | # vnc 19 | RUN apt-get update && apt-get install -y xvfb x11vnc icewm lsof net-tools 20 | RUN echo "alias vnc='PASSWORD=\$(openssl rand -hex 24); for i in {99..0}; do export DISPLAY=:\$i; if ! xdpyinfo &>/dev/null; then break; fi; done; for i in {5999..5900}; do if ! netstat -tuln | grep -q \":\$i \"; then PORT=\$i; break; fi; done; Xvfb \$DISPLAY -screen 0 1400x900x24 & until xdpyinfo > /dev/null 2>&1; do sleep 0.1; done; x11vnc -forever -noxdamage -display \$DISPLAY -rfbport \$PORT -passwd \$PASSWORD > /dev/null 2>&1 & until lsof -i :\$PORT > /dev/null; do sleep 0.1; done; icewm-session &; echo DISPLAY=\$DISPLAY, PORT=\$PORT, PASSWORD=\$PASSWORD'" >> ~/.zshrc 21 | 22 | # venv 23 | RUN python -m venv /root/venv/work 24 | RUN source /root/venv/work/bin/activate && \ 25 | pip install -U pip setuptools && \ 26 | pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --extra-index-url https://download.pytorch.org/whl/cu118 && \ 27 | echo 'source /root/venv/work/bin/activate' >> /root/.zshrc 28 | 29 | # utils 30 | RUN apt-get update && apt-get install -y htop vim ffmpeg 31 | RUN source /root/venv/work/bin/activate && \ 32 | pip install jupyterlab ipywidgets && \ 33 | echo 'alias jup="jupyter lab --ip 0.0.0.0 --port 8888 --allow-root &"' >> /root/.zshrc 34 | 35 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* 36 | 37 | WORKDIR /root 38 | CMD ["zsh"] 39 | --------------------------------------------------------------------------------