ubuntu docker 常用命令
ubuntu docker 使用命令: 1 拉取镜像 docker pull imageID 2 运行docker (不带GPU) -v 选择挂载目录 docker run -v /home/111 -it imageID bash 3 运行docker (带GPU, 使用nvidia-smi) 此博客对挂载GPU介绍的特别透彻: https://www.cnblogs.com/oolo/p/11679733.html 这两个命令可以查看nvidia信息: lsmod|grep nvidia ll /dev/|grep nvidia 3.1 需要先修改 /etc/docker/daemon.json, 把nvidia弄进来,前提是安装好nvidia驱动 vim /etc/docker/daemon.json { "default-runtime":"nvidia", "runtimes": { "nvidia": { "path": "/usr/bin/nvidia-container-runtime", "runtimeArgs": [] } }, "exec-opts": ["native.cgroupdriver=systemd"] } 3.2 reload 文件 systemctl daemon-reload 3.3 重启docker service docker restart 3.4 运行docker 运行时根据需求指定gpu设备, 指定imageID, --device 指定设备 -v 挂载目录 -it 运行镜像 docker run --device /dev/nvidia0:/dev/nvidia0 --device /dev/nvidiactl:/dev/nvidiactl --device /dev/nvidia-uvm:/dev/nvidia-uvm --device /dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools --device /dev/nvidia-modeset:/dev/nvidia-modeset -v /usr/bin/:/usr/bin -v /usr/lib:/usr/lib -it 96da9143fb18 bash 4 查看docker 镜像 docker images 5 查看docker 容器 docker ps -a 6 停止容器 和删除容器 docker stop containerID docker rm containerID 7 删除镜像 docker stop containerID docker rm containerID docker rmi imageID 8 保存镜像 docker commit -m "描述" -a "作者信息" imageID imageName
相关推荐
魅惑青花瓷 2020-11-11
yangkang 2020-11-09
MichaelJScofield 2020-11-06
TaoTaoFu 2020-11-06
liaochaowu 2020-11-16
ChlatZed 2020-11-11
lnkToKing 2020-10-29
ChlatZed 2020-10-27
ChlatZed 2020-10-13
时光流水 2020-09-23
yangkang 2020-09-23
changecan 2020-09-22
dusuanyun 2020-09-21
newisI 2020-09-01
liaochaowu 2020-09-14
ShangQuan0 2020-09-10
fearlessxjdx 2020-09-04
libra0 2020-09-02
ChlatZed 2020-08-23
王道革 2020-11-25
lihongtai 2020-11-09
xysoul 2020-11-03