Common command of docker

1. CentOS version
docker requires that the kernel version of CentOS system is higher than 3.10, and view the version through uname – R

2. Upgrade package kernel (optional)
Yum update

3. Install docker
Yum install docker

4. Start docker
sudo service docker start

5. Set the docker service to boot
systemctl enable docker

6. Remove the docker from the boot entry
systemctl stop docker

7. Search docker image (docker search keyword)
docker search redis

8. Pull the image file
docker pull image name: tag (tag is optional, the default is latest)

9. View the downloaded image
docker images

10. Delete the image
docker RMI image ID (container ID)

11. Run the docker container (- D: running in the background)
docker – run – name custom container name – D specifies the image template( imageName:tag , if tag is latest, it can be omitted.)

12. View running containers (add – A to view all containers)
docker PS

13. Stop the running container
docker stop image ID

14. Delete container (different from deleting image, here is RM)
docker RM image ID

15. When starting the container, map the port of the JVM and the port of the Tomcat container
docker – run name custom container name – D – P 8888:8080 specify the image template
note: to start mysql, you need to specify the password, and you need to specify the password through the – e command

16. View the firewall status
service firewalld status

17. View the container log
docker log image ID

Read More: