Docker is a container that can be used to manage any application component. It is weakly coupled, extensible, and easy to migrate services. Three core concepts: Images (stored in layers, images are organized by layers, if a layer exists, it will be directly used rather than repeatedly created, so that the reuse of each layer greatly saves storage space), containers (equivalent to lightweight sandboxes), warehouses (repositories of images)
1. Docker installation in centos:
Loading docker: tee/etc/yum repos. D/docker. ‘< < -‘ EOF ‘
Update yum: yum -y update
Yum -y install docker-engineto
\
You can also install it with a script:
curl -fsSL get.docker.com/ | sh
或
wet -qO- get.docker.com/ | sh
Docker pull centos:7
Create a container docker run -it centos:7 bash
Run ping localhost
4. Listing image information: Docker Images
5. Add the image tag docker tag centos:latest mycentos:latest
Docker inspect for image details
Docker inspect -f {docker inspect -f {
{“. Key name “}}
Docker history centos:7
Docker search centos
Docker rmi mycentos:latest
11. View all containers on the machine: Docker ps-A
12. Complete deletion:
Delete a container: docker rm containerID
Delete image: Docker RMI Mirrored (Mirror ID)
Docker commit -m “image info” -a “author” containerID test:1.1
14. Based on the local template import mirror: cat centos_7. Tar. Gz | docker import – centos: 7
15. Export the local image as a tar package: docker save -o centos_7.tar centos:7
Docker load –input centos_7.tar or docker load < centos_7.tar
17. Upload the self-made image to the warehouse, which is uploaded to Docker Hub by default. Log in or register for the first time:
Add tag: docker tag test:1 usr/test:1
Upload: docker push usr/test:1