美文网首页
SSH登陆gpu-docker

SSH登陆gpu-docker

作者: 皇甫LG | 来源:发表于2020-03-29 20:49 被阅读0次

一、启动gpu-docker容器

docker run --name szhq-ssh -i -t -d --runtime nvidia -e NVIDIA_VISIBLE_DEVICES=1  tensorflow/tensorflow:test-gpu   /bin/bash
## NVIDIA_VISIBLE_DEVICES=1 表示将GPU第1号核心分配给test-gpu容器使用。

二、安装openssh

apt-get update -y
apt-get install -y openssh-server openssh-client vim

三、配置SSHD

# passwd     //记录密码,提供给使用者。

# vim ~/.bashrc
添加/usr/sbin/sshd

# mkdir -p  /var/run/sshd

# vim /etc/ssh/sshd_config
PermitRootLogin yes

四、提交容器成为新的镜像

# docker commit 3ea7a99a0025   sshd_gpu_01

五、停止并删除容器

# docker stop [container-id]
# docker rm [container-id]

六、后台启动一个新的容器

# docker run --name szhq-gpu -d --runtime nvidia -e NVIDIA_VISIBLE_DEVICES=1  -p 8001:22 sshd_gpu_01 /usr/sbin/sshd -D

七、ssh远程登录该容器

# ssh root@localhost -p 8001

相关文章

网友评论

      本文标题:SSH登陆gpu-docker

      本文链接:https://www.haomeiwen.com/subject/lrfpuhtx.html