現在のシステムに基づいてdockerミラーを作成する

1616 ワード

1: tar  
tar -cvpf /home/buildrpm.tar --directory=/ --exclude=proc --exclude=sys --exclude=dev --exclude=run /
[root@localhost home]# ls
buildrpm.tar
2: 
cat buildrpm.tar | docker import - buildrpm。
 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
 docker service
[root@localhost home]# service docker start
3: 
[root@localhost home]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
buildrpm            latest              15adc9614eb8        17 seconds ago      1.14 GB
[root@localhost home]# docker run -it buildrpm:latest /bin/bash
4 :
[root@localhost home]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
920f5a69f58d        buildrpm:latest     "/bin/bash"         2 minutes ago       Exited (0) 2 minutes ago                       laughing_minsky
[root@localhost home]# docker rm 920f5a69f58d
920f5a69f58d
[root@localhost home]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
buildrpm            latest              15adc9614eb8        4 minutes ago       1.14 GB
[root@localhost home]# docker rmi 15adc9614eb8
Untagged: buildrpm:latest
Deleted: sha256:15adc9614eb815974edfaca89671f86ea61e46929792c42f7515dfd65ff24688
Deleted: sha256:aed61d9930e43fbf0c5d3a771b9dde602b0dda2fec6066a166d2ba9180402880
[root@localhost home]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE