Use of RHEL7 Docker Virtualization (2)
Docker is an open source tool that makes it easy to create and manage linux containers. Containers are like lightweight virtual machines. As a new way of virtualization, Docker has many advantages over traditional virtualization methods.
Environment: Centos7ip:172.16.1.10Docker version 1.13.1 runs a container, "- I" captures standard input and output, and "- t assigns a console" [root@localhost ~] # docker run-I-t centos / bin/bash [root@86a46aa13531 /] # lsbin dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var [root@86a46aa13531 /] # to create an image
-an author information,-m submission information,-p pauses the container when it is submitted, and returns an id number string if the submission is successful.
[root@localhost ~] # docker commit-m "aaa"-a "chao" 86a46aa13531sha256:6efd478542f1a99b20796c9372c2976b87344263a051dbf39fd385ea4dbb8873 View Image [root@localhost ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEchao latest 7b6e3368140a 47 hours ago 237 MB 6efd478542f1 47 hours ago 237 MBdocker.io/centos Latest 470671670cac 6 weeks ago 237 MB roll-out to mirror
The docker save command transfers out, and the docker load command transfers in.
Transfer the chao image to CHAO [root@localhost ~] # docker save-o CHAO.tar chao:latest [root@localhost ~] # ls123 anaconda-ks.cfg CHAO.tar initial-setup-ks.cfg delete the image [root@localhost ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEchao latest 7b6e3368140a 47 hours ago 237 MB 6efd478542f1 47 hours ago 237 MBdocker.io/centos latest 470671670cac 6 weeks ago 237 MB [root@localhost] # docker rmi-f 7b6e3368140a Untagged: chao:latestDeleted: sha256:7b6e3368140ac0e977bc37110f267e3c7b641e0b42ba04e93b1bbda46331c29c [root@localhost] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE 6efd478542f1 47 Hours ago 237 MBdocker.io/centos latest 470671670cac 6 weeks ago 237 MB transferred to image [root@localhost ~] # docker load < chao.tarLoaded image: chao:latest [root@localhost ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEchao latest 7b6e3368140a 47 hours ago 237 MB 6efd478542f1 47 hours ago 237 MBdocker.io/centos latest 470671670cac 6 weeks ago 237 MB
These are the basic operations of docker.
Original address: https://www.linuxprobe.com/rhel-docker-xuni.html