Docker Basic Operation Guide
Pulling the base image:
docker pull centos:latest
The base Centos Mirror operation of a container called base-centos
docker run --name base-centos -d centos:latest
The local copy of the JDK to the vessel
docker cp /home/kxvz/jdk-8u201-linux-x64.rpm base-centos:/opt
View all containers
docker ps -a
View all vessels operating
docker ps
Stop running container
docker stop CONTAINER_ID
Start and stop container
docker start CONTAINER_ID
Into the container using the command
docker exec -it CONTAINER_ID /bin/bash
Delete container
docker rm CONTAINER_ID
See all mirrors
docker images
Remove Mirror
docker rmi IMAGE_ID
Login docker hub
docker login
The container packed into a mirror
docker commit CONTAINER_ID mirror name
如: docker commit 34e82f99ba41 base-centos
Mirror is packaged tagging
docker tag name Mirror Mirror name DockerHub name /: version number (if the default is not written version of the latest)
如: docker-base tag hundreds kxvz / base-cent
Push the mirror to Dockerhub
docker push DockerHub name / image name
如: docker push kxvz/base-centos
You can use the command to start a container systemctl
docker run --privileged -ti --name kxvz-base base-centos /usr/sbin/init
Docker copied from the host to the container
docker cp host_path containerID:container_path
Copy from the container to the host
docker cp 667b3323ea44:/etc/my.cnf ./
View log in 2 minutes
journalctl --since "2 min ago"
docker run --privileged -ti -d -p 55001:22 -p 55002:27200 -v /home:/home --name kxvz-base base-centos /usr/sbin/init
-v /home:/home
==LOG-Footer Start==================================
Number of public: Loyomer
Simple: Kxvz life pocket book. Technology, life, essays, abstracts ...
Welcome to the concern ...
==LOG-Footer End==================================
==LOG-Footer Start==================================
Number of public: Loyomer
Simple: Kxvz life pocket book. Technology, life, essays, abstracts ...
Welcome to the concern ...