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

What is this in JavaScript point by point series

Understand this Perhaps you have seen this in oth...

How to use CSS styles and selectors

Three ways to use CSS in HTML: 1. Inline style: s...

Getting Started Guide to Converting Vue to React

Table of contents design Component Communication ...

In-depth analysis of MySQL indexes

Preface We know that index selection is the work ...

The concept of MTR in MySQL

MTR stands for Mini-Transaction. As the name sugg...

Analyze the working principle of Tomcat

SpringBoot is like a giant python, slowly winding...

How to let DOSBox automatically execute commands after startup

Using DOSBox, you can simulate DOS under Windows ...

JavaScript to achieve simple drag effect

This article shares the specific code of JavaScri...

Mysql sets boolean type operations

Mysql sets boolean type 1. Tinyint type We create...

Implementing a web player with JavaScript

Today I will share with you how to write a player...

Detailed explanation of the implementation of nginx process lock

Table of contents 1. The role of nginx process lo...

Will mysql's in invalidate the index?

Will mysql's IN invalidate the index? Won'...

Basic usage tutorial of MySQL slow query log

Slow query log related parameters MySQL slow quer...