Summary of common docker commands

Summary of common docker commands

Docker installation

1. Requirements: Linux kernel version 3.10 or above View:

uname -r

Kernel upgrade:

yun update

2. Docker installation

yum install docker

3. Check the docker version

docker -v

4. Docker startup

systemctl start docker

5. Stop docker

systemctl stop docker

6. Set up Docker startup

systemctl enable docker

Docker Uninstall

View Software Installation

rpm -qa |grep -i docker

or

yum list installed | grep docker

Uninstall Docker

yum remove docker*.x86_64

//Delete related images and containers

rm -rf /var/lib/docker

Common Docker Operations

1. Search:
docker search keywords
For example:

docker search mysql

2. Pull
docker pull image name [:tag] (:tag is optional, refers to the version number, if no tag is specified, the default is latest)

docker pull docker pull tomcat:8.0.18-jre7

3. View local image

docker images

4. Delete the image

docker rmi image-id

5. Run the container

docker run --name mytomcat -d tomcat:8.0.18-jre7

Start tomcat:

docker run -d -p 8888:8080 --name mytomcat tomcat:8.0.18-jre7

Start mysql:

docker run --name mysql01 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6

Start redis:

docker run -d -p 6379:6379 --name redis01 redis:4.0.12

Start RabbitMQ:

docker run -d -p 5672:5672 -p 15672:15672 --name rabbitMQ 41f7a13e37d3

Check the redis version under docker:

docker exec -it redis01 redis-server -v

-p: port mapping, the virtual machine's port 8888 is mapped to the tomcat container's port 8080
mytomcat: is a custom name
-d: indicates background operation

6. View the containers running in Docker

docker ps

7. View all containers in Docker

docker ps -a

8. Stop the running container

docker stop container-id or container name

9. Restart the container

docker start container-id

10. Delete the container (the container needs to be in the stopped state)

docker rm container-id

11. Check the firewall status

service firewalld status
service firewalld stop: Turn off the firewall

12. View container logs

docker logs container-id

This is the end of this article about the summary of commonly used docker commands. For more related commonly used docker commands, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Basic introduction and use of Docker container image related commands
  • Summary of essential Docker commands for developers
  • Summary and analysis of commonly used Docker commands and examples
  • Detailed explanation of common Docker commands
  • Summary of common docker commands (recommended)
  • A complete guide to the Docker command line (18 things you have to know)
  • Summary of learning Docker commands in one article
  • Introduction to common Docker commands

<<:  Brief analysis of the introduction and basic usage of Promise

>>:  Application of HTML and CSS in Flash

Recommend

Tutorial on installing MYSQL5.7 from OEL7.6 source code

First, download the installation package from the...

Detailed explanation of common commands in Docker repository

Log in docker login Complete the registration and...

Detailed explanation of how MySQL (InnoDB) handles deadlocks

1. What is deadlock? The official definition is a...

Implement QR code scanning function through Vue

hint This plug-in can only be accessed under the ...

Detailed explanation of the use of MySQL mysqldump

1. Introduction to mysqldump mysqldump is a logic...

Detailed analysis of the difference between Ref and Reactive in Vue3.0

Table of contents Ref and Reactive Ref Reactive T...

Uniapp uses Baidu Voice to realize the function of converting recording to text

After three days of encountering various difficul...

Detailed explanation of how to solve the problem of too long content in CSS

When we write CSS, we sometimes forget about the ...

How to use html2canvas to convert HTML code into images

Convert code to image using html2canvas is a very...

Elementui exports data to xlsx and excel tables

Recently, I learned about the Vue project and cam...

Detailed explanation of various loop speed tests in JS that you don’t know

Table of contents Preface 1. for loop 2. while lo...

How to import and export Cookies and Favorites in FireFox

FireFox is a commonly used browser with many exte...

MySQL group query optimization method

MySQL handles GROUP BY and DISTINCT queries simil...

js memory leak scenarios, how to monitor and analyze them in detail

Table of contents Preface What situations can cau...

CSS sets the list style and creates the navigation menu implementation code

1. Set the list symbol list-style-type: attribute...