服务器docker + pycharm + xshell 配置

时间:2024-05-21 14:23:21

Table of Contents

docker的创建:

1、服务器上安装好docker

2、查找安装对应的镜像

3、在终端中下载相关的镜像

4、docker images 查看相关的镜像的 id

5、创建容器

4、5 相关的截图

6、配置ssh的协议 + pycharm + xshell 连接服务器

Xshell

7、退出容器后,重新启动该容器并且在后台运行


 

引言


该教程的准备前,需要在服务器上安装docker

 

  • 其他的一些参考资料

pycharm 远程连接docker容器调试程序

https://blog.****.net/hanchaobiao/article/details/84069299

 

PyCharm+Docker:打造最舒适的深度学习炼丹炉

https://zhuanlan.zhihu.com/p/52827335

 

 

docker的创建:


1、服务器上安装好docker

2、查找安装对应的镜像

在下面的docker hub 中找到自己合适的镜像

Docker Hub

https://hub.docker.com/

 

如,下载一个pytorch相关的镜像

Explore - Docker Hub

https://hub.docker.com/search?q=pytorch&type=image

 

3、在终端中下载相关的镜像

docker pull dsksd/pytorch:0.4.1

docker pull 下载镜像的命令

dsksd/pytorch 为镜像的名称

0.4.1  为对应的标签的版本

 

4、docker images 查看相关的镜像的 id

 

 

[email protected]:~$ docker images

WARNING: Error loading config file: /home/xyj/.docker/config.json: stat /home/xyj/.docker/config.json: permission denied

REPOSITORY TAG IMAGE ID CREATED SIZE

nvidia/cuda 9.0-base 1476e7f683da 2 weeks ago 175MB

nvidia/cuda 9.0-base-ubuntu16.04 cfab853500aa 2 weeks ago 174MB

nvidia/cuda 10.0-base 1ab2d3e6e58d 2 weeks ago 112MB

mycaffe/gpu 1.0 6570aaff012f 2 weeks ago 5.17GB

nvidia/cuda <none> 721bf18dc98f 5 weeks ago 137MB

nvidia/cuda <none> e5eb52810532 5 weeks ago 110MB

caffe/gpu 0.1 8deef48b1da2 5 weeks ago 15.8GB

caffe 0.1 697b3f6e7043 6 weeks ago 14.4GB

pytorch/pytorch nightly-devel-cuda10.0-cudnn7 a5b30513fbc1 2 months ago 6.4GB

nvidia/cuda <none> cec06c83b6d6 3 months ago 137MB

nvidia/cuda <none> e0719fc05fac 3 months ago 165MB

nvidia/cuda <none> 53418d80213d 3 months ago 115MB

nvidia/cuda 9.0-cudnn7-runtime-ubuntu16.04 3b75042d0c57 3 months ago 1.22GB

nvidia/cuda 10.0-cudnn7-runtime-ubuntu16.04 37aa75fe187f 3 months ago 1.33GB

daocloud.io/daocloud/tensorflow latest c9a0882cbdbc 4 months ago 1.05GB

tensorflow/tensorflow latest c9a0882cbdbc 4 months ago 1.05GB

ufoym/deepo latest 3256880e4c5b 4 months ago 10.6GB

kbobrowski/tensorflow-gpu-opencv latest 38069988e9ae 5 months ago 3.91GB

container-314 latest bfc13bc0d9c9 5 months ago 19.2GB

c-new latest 905996b83494 5 months ago 14.8GB

nvidia/cuda 9.0-cudnn7-devel-ubuntu16.04 f780be4907ca 6 months ago 2.71GB

nvidia/cuda 10.0-cudnn7-devel-ubuntu16.04 fdbd6d128838 6 months ago 3.09GB

nvidia/cuda 8.0-devel a8f4ac5ee686 6 months ago 1.7GB

tensorflow/tensorflow <none> 72bdfab04989 6 months ago 1.1GB

nvidia/cuda latest d9a8427c8dd9 7 months ago 2.35GB

dbctraining/pytorch0.4.1-gpu-cuda9-cudnn7-py3 v1.0.1 f57cdd7c8b7f 7 months ago 3.04GB

anibali/pytorch cuda-9.2 86b1edf0bd95 8 months ago 3.51GB

daocloud.io/daocloud/tensorflow nightly-devel-gpu-py3 beb1f2c06280 9 months ago 3.88GB

blinkeye/deepo-tf-caffe-opencv-dlib-py3 latest 294b5124decf 10 months ago 4.74GB

dsksd/pytorch 0.4.1 a8bdabe9931a 11 months ago 11.7GB

tensorflow/tensorflow 1.8.0-devel-gpu-py3 fff42c2fd81c 16 months ago 3.13GB

bvlc/caffe gpu ba28bcb1294c 16 months ago 3.38GB

rynge/osg-tensorflow-gpu latest e5100c70954f 22 months ago 7.14GB

drunkar/anaconda-tensorflow-gpu latest a120be75d222 3 years ago 3.61GB

[email protected]:~$ docker images | grep dsksd

WARNING: Error loading config file: /home/xyj/.docker/config.json: stat /home/xyj/.docker/config.json: permission denied

dsksd/pytorch 0.4.1 a8bdabe9931a 11 months ago 11.7GB

 

docker images | grep dsksd

| 管道符,同时运行两个命令

grep 过滤

dsksd 过滤要找的关键词

 

5、创建容器

[email protected]:~$ sudo docker run --name xjr_pytocrh -it -v /home/xyj/xjr_directory/:/home/xjr_directory -p 6898:22 -p 6806:6066 -p 6088:8888 a8bda /bin/bash

 

4、5 相关的截图

服务器docker + pycharm + xshell 配置

 

6、配置ssh的协议 + pycharm + xshell 连接服务器

 

pycharm

pycharm 远程连接docker容器调试程序

https://blog.****.net/hanchaobiao/article/details/84069299

 

PyCharm+Docker:打造最舒适的深度学习炼丹炉

https://zhuanlan.zhihu.com/p/52827335

 

Xshell

(1条消息)Xshell如何连接Docker容器中的Linux - u010046887的专栏 - ****博客

https://blog.****.net/u010046887/article/details/90406725

 

7、退出容器后,重新启动该容器并且在后台运行

找到该容器

[email protected]:~$ docker ps

 

重新启动该容器,并在后台运行

[email protected]:~$ docker exec -it 9ce bash

 

 

 

服务器docker + pycharm + xshell 配置