2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

(自分用)GPU+Python開発用Dockerfile

Last updated at Posted at 2024-03-17
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
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?