Docker
镜像加速器
vi /etc/docker/daemon.json
"registry-mirrors": [
"https://mirror.baidubce.com",
"https://docker.mirrors.ustc.edu.cn",
"https://docker.io"
]镜像
- 获取镜像
$ docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签] - 列出镜像
docker image ls - 查看镜像、容器、数据卷所占用的空间
docker system df - 删除无用虚悬镜像
docker image prune - 删除本地镜像
$ docker image rm [选项] <镜像1> [<镜像2> ...]
容器
-
运行容器
$ docker run -it --rm ubuntu:18.04 bash -
启动已终止容器
docker container start -
参数
-d让容器后台运行- 获取容器输出
docker container logs
- 获取容器输出
-
终止、重启容器
docker container stop/restart -
打开后台运行的容器
docker exec -
导出、导入
docker export/import -
删除
docker container rm -
清理掉所有处于终止状态的容器
docker container prune -
端口映射
-p\-P IP:host_port:container_port -
绑定目录
docker run --mount type=bind,src=$PWD,dst=/etc,ro ...
其他
无法启动docker-desktop
wsl --unregister docker-desktop
wsl --unregister docker-desktop-datavim 修改文件
设置选项 set backupcopy=yes or set bkc=yes
限制资源使用
docker update --cpus '3.5' --memory '8G' IDpodman
镜像配置 阿里云:aliyun podman mirror
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "xxxxxx.mirror.aliyuncs.com"使用nvidia显卡
1. 安装 nvidia 驱动
2. 安装 docker-ce
Install Docker Engine on Ubuntu | Docker Documentation
3. 安装 Nvidia Docker 2.0
Installation Guide — NVIDIA Cloud Native Technologies documentation
4. 拉取 tensorflow 镜像
5. 创建 Dockerfile
Sample application | Docker Documentation
6. 补充。。。
TensorFlow with GPU using Docker (and PyCharm) (josehoras.github.io)
