docker desotop 学习记录

 # 源
 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install colorlog -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install seaborn -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install opencv-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
# 运行报错

pip install opencv-python-headless -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install scikit-image  -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
# 版本太高不兼容

pip install scikit-image==0.16.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
import _tkinter # If this fails your Python may not be configured for Tk ImportError: libX11.so.6: cannot open shared object file: No such file or directory
# 解决办法
apt-get update
apt install python3-tk
apt install tk-dev 
// apt-get install rpm

查看镜像

docker images

挂载镜像

docker run -it cuda11.3:v2 /bin/bash
  • -i:交互操作
  • -t:终端
  • cuda11.3:v2 对应的即为 REPOSITORY:TAG
  • /bin/bash:这里我们希望有个交互式 Shell,因此用的是 /bin/bash

挂载镜像

docker run -it -v E:\2022\pb_research:/data_test1 cuda11.3:v4 /bin/bash 

GPU的形式挂载镜像

docker run --gpus all -it -v E:\2022:/data_2022 cuda11.3:v6 /bin/bash 

保存修改容器为镜像

docker commit f5e689d5d7a0 cuda11.3:v6
# 保存容器f5e689d5d7a0为镜像cuda11.3:v6

导出镜像

docker save cuda11.3:v6|gzip > cuda113_v6.tar.gz
docker save -o D:\cuda113_v6.tar cuda11.3:v6

加载导出的镜像

docker load < /root/gf/python_images.tar.gz
docker load < C:/Users/YJH/cuda113_v6.tar

查看正在运行的容器

docker container ls

删除正在运行的容器 ff871003844b

docker kill ff871003844b

重新cmd 复制文件到docker

在容器已经运行后拷贝

docker cp D:\Desktop\Arial.ttf ff871003844b://root/.config/Ultralytics/ 
将主机 D:\Desktop\Arial.ttf 拷贝到 容器ff871003844b的//root/.config/Ultralytics/目录下
docker cp D:\Desktop\mobilenet_v2-b0353104.pth ff871003844b://root/.cache/torch/hub/checkpoints/
将主机  D:\Desktop\mobilenet_v2-b0353104.pth 拷贝到 容器ff871003844b的//root/.cache/torch/hub/checkpoints/目录下
将主机/www/runoob目录拷贝到容器96f7f14e99ab的/www目录下。
docker cp /www/runoob 96f7f14e99ab:/www/

将主机/www/runoob目录拷贝到容器96f7f14e99ab中,目录重命名为www。
docker cp /www/runoob 96f7f14e99ab:/www

将容器96f7f14e99ab的/www目录拷贝到主机的/tmp目录中。
docker cp  96f7f14e99ab:/www /tmp/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值