[Docker] docker operation of commonly used commands &

First, install linux virtual machine on a docker

XShell
. 1: Check kernel version must be 3.10 or more and
  the uname -R & lt
2: Installation Docker
  yum the install Docker
. 3: Installation answer y
4: Start Docker
  [the root @ localhost ~] # systemctl Start Docker
  [the root @ localhost ~] # Docker -v
  Docker Version 19.03.2, Build 6a30dfc
5: boot Docker
  [root @ localhost ~] # systemctl Docker enable
  the Created from /etc/systemd/system/multi-user.target.wants/docker.service symlink to / usr / . lib / systemd / System / docker.service
. 6: stop Docker
  systemctl sTOP Docker

Second, the mirroring

1: Search docker search image name  

2: Pull docker pull mirroring name: tag (tag is optional, multi-version software, the default is the latest)

3: List docker images (see all local mirror)

4: Remove docker rmi image-id (delete the specified local mirror)

Third, the operation of the vessel

XShell
. 1: search image
  [the root @ localhost ~] Search # Docker Tomcat
2: Mirror pulling
  [the root @ localhost ~] # Docker pull Tomcat
. 3: The image starting container
  Docker RUN --name mytomcat -d Tomcat: Latest
. 4: View the operation of the vessel
  Docker PS 
5: stop running container
  id docker stop container of
6: View all containers
  Docker PS -a
7: start container
  docker start container the above mentioned id
8: delete a container
  docker rm container the above mentioned id
9: start a do the port mapping Tomcat
  [root @ localhost ~] # Docker rUN -d -p 8888: 8080 Tomcat
  -d: background
  -p: the host port mapping to the container port of a host port: the interior of the container port

10: To demonstrate the simple closed linux firewall
  service firewalld status; see firewall status
  service firewalld stop: turn off the firewall
11: View container logs
  docker logs container-name / container- id

 

Guess you like

Origin www.cnblogs.com/EveningWind/p/11615315.html