FROM nvidia/cuda:12.1.0-base-ubuntu22.04
# aptの更新など
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y htop vim wget curl
RUN apt-get install -y nodejs npm
RUN apt-get install -y python3.10 python3-pip
RUN apt-get install -y openssh-server
RUN apt-get clean
# .bashrcの編集
RUN sed -i 1iforce_color_prompt=yes /root/.bashrc
RUN echo alias la="'ls -lah'" >> /root/.bashrc
# SSH接続のための設定
RUN mkdir /var/run/sshd
RUN echo '\n'PermitRootLogin yes >> /etc/ssh/sshd_config
RUN mkdir /root/.ssh
COPY $HOME/.ssh/id_rsa.pub /root/.ssh/authorized_keys
RUN chmod 600 /root/.ssh/authorized_keys
# runしたときにSSH接続を開始
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
## コマンド
# docker build -f .\work\dockerfiles\ssh_ubuntu_cuda -t ssh:ubuntu22.04-cuda12.1 .
# docker run --gpus all --name ssh_ubuntu_cuda -d -p 10000:22 -p 8888:8888 ssh:ubuntu22.04-cuda12.1
# ssh root@127.0.0.1 -p 10000
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme