如何从图像创建 Docker 容器

如何从图像创建 Docker 容器

我有以下图片:

REPOSITORY               TAG         IMAGE ID       CREATED       SIZE
nvcr.io/nvidia/pytorch   18.04-py3   c3555fec4fe6   3 years ago   5.9GB
The goal is to use Ubuntu 18.04 with CUDA 10.2. 

现在我想用这个镜像创建一个容器。这些是我尝试过的命令:

docker image tag nvcr.io/nvidia/pytorch:18.04-py3 pytorch

docker run pytorch

但这是错误:

docker: Error response from daemon: 
mkdir /var/lib/docker/containers/22346b8352726ee06780791c3ee37c138b8c4b3d600225502266916e57902c56: 
no such file or directory.

答案1

要标记图像克隆并运行,请尝试以下操作:

列出图像

# docker images
REPOSITORY                           TAG       IMAGE ID       CREATED         
SIZE
jupyter/datascience-notebook         latest    f5573d8505f2   4 months ago    4.14GB
centos                               latest    5d0da3dc9764   6 months ago    231MB

标记您的图像并检查新的克隆

[root@local ~]# docker tag centos:latest centos_1:clone
[root@local ~]# docker images
REPOSITORY                           TAG       IMAGE ID       CREATED         SIZE
jupyter/datascience-notebook         latest    f5573d8505f2   4 months ago    4.14GB
centos                               latest    5d0da3dc9764   6 months ago    231MB
centos_1                             clone     5d0da3dc9764   6 months ago    231MB

将克隆映像作为容器运行

[root@local ~]# docker run -it 5d0da3dc9764 bash
[root@99d655eb9ef0 /]#

相关内容