常用命令
临时启动镜像
docker run -it --rm --name xxx image-name
启动容器
docker run -it -d --name -v /path:/path -p80:80 -e MYSQL_USER="test" image-name
进入容器
docker exec -it docker-name bash
nvidia docker 容器内使用显卡
参考:https://cloud.tencent.com/developer/article/1924792
- 安装nvidia-docker2并重启
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
apt-get update
apt-get install -y nvidia-docker2
sudo systemctl restart docker
- 使用方式
docker run -it --gpus all nvidia/cuda:11.4.0-base-ubuntu20.04 nvidia-smi
标签:name,--,list,apt,笔记,nvidia,docker
From: https://www.cnblogs.com/jasmine456/p/18111263