Docker 导出容器导入后无法运行报错:Error response from daemon: No command specified.

Docker 导出容器导入后无法运行报错:Error response from daemon: No command specified.

根据报错信息是没有指定 command 加上 command即可运行

[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/ubuntu    latest              fb52e22af1b0        3 weeks ago         72.8 MB

[root@localhost ~]# docker run -itd docker.io/ubuntu:latest
7ce403eba8d89127395e057eb4d6cf7eb2374e40214ce6575a29e755b707ca23

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS              PORTS               NAMES
7ce403eba8d8        docker.io/ubuntu:latest   "bash"              4 seconds ago       Up 3 seconds                            hungry_babbage
[root@localhost ~]# docker export -o test.tar 7ce403eba8d8

[root@localhost ~]# ls
anaconda-ks.cfg  test.tar

[root@localhost ~]# docker import test.tar test/ubuntu:v0.1
sha256:c3d604273769f7a74126b27f29c8cecd055fc18b10c943da0c0528dc28520a60

[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
test/ubuntu         v0.1                c3d604273769        4 seconds ago       72.8 MB
docker.io/ubuntu    latest              fb52e22af1b0        3 weeks ago         72.8 MB

[root@localhost ~]# docker run -itd test/ubuntu:v0.1
/usr/bin/docker-current: Error response from daemon: No command specified.
See '/usr/bin/docker-current run --help'.

# 加上 /bin/bash 完美运行
[root@localhost ~]# docker run -itd test/ubuntu:v0.1 /bin/bash
5b7dca448a1400716fa931463c2c314e0e59c7888fa77d5b182e72d911122966

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS              PORTS               NAMES
5b7dca448a14        test/ubuntu:v0.1          "/bin/bash"         3 seconds ago       Up 2 seconds                            zen_varahamihira
7ce403eba8d8        docker.io/ubuntu:latest   "bash"              5 minutes ago       Up 5 minutes                            hungry_babbage

你可能感兴趣的:(Docker,docker,ubuntu,linux)