[root@geeklinux ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/ubuntu latest fb52e22af1b0 3 weeks ago 72.8 MB
[root@geeklinux ~]# docker run -itd docker.io/ubuntu:latest
7ce403eba8d89127395e057eb4d6cf7eb2374e40214ce6575a29e755b707ca23
[root@geeklinux ~]# 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@geeklinux ~]# docker export -o test.tar 7ce403eba8d8
[root@geeklinux ~]# ls
anaconda-ks.cfg test.tar
[root@geeklinux ~]# docker import test.tar test/ubuntu:v0.1
sha256:c3d604273769f7a74126b27f29c8cecd055fc18b10c943da0c0528dc28520a60
[root@geeklinux ~]# 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@geeklinux ~]# 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@geeklinux ~]# docker run -itd test/ubuntu:v0.1 /bin/bash
5b7dca448a1400716fa931463c2c314e0e59c7888fa77d5b182e72d911122966
[root@geeklinux ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5b7dca448a14 test/ubuntu:v0.1 "/bin/bash" 3 seconds ago Up 2 seconds
本文来自投稿,不代表极客运维立场,如若转载,请注明出处:https://www.geeklinux.cn/cloud-native/docker/176.html