Docker common commands, install common instances, install mysql in one step

I just came to the company and tested the server of the environment project with the company. The environment is linux Centos7.2. All tomcats are mounted under the docker container, so I also learned some simple docker commands (please understand what docker is before learning, and know what docker is). common linux commands).

List some commonly used ones:

docker pull mysql 5.7 in one step

$ docker run -d -e MYSQL_ROOT_PASSWORD=admin --name mysql -v /data/mysql/data:/var/lib/mysql -p 3306:3306 mysql

The default password admin can be changed if you want to modify it. --name is the instance name mysql -v will reflect the /data/mysql/data host (that is, the path of centos) to port 3306 under /var/lib/mysql

Docker install zookeeper in two steps

docker pull docker.io/jplock/zookeeper

docker run -d --name zookeeper --publish 2181:2181 jplock/zookeeper:3.4.6

Similar to MySQL

docker install tomcat in one step

docker run --privileged=true -v /xxx:/usr/local/tomcat/webapps/ROOT -p 8081:8080 tomcat:8

The port is defined by itself, xxx is the running path of the project under the linux host, that is, the project path of the webapps under tomcat, reflected to ROOT

docker install rabbitmq in one step

docker run -d --name rabbitmq --publish 5671:5671 --publish 5672:5672 --publish 4369:4369 --publish 25672:25672 --publish 15671:15671 --publish 15672:15672 rabbitmq:management

Note: If the port is opened, the firewall under the server must open the custom port, and the security group is also

docker install redis

docker run redis --name redis -p 6379:6379 -d redis-server

docker install nginx

docker pull nginx

docker run -p 80:80 --name nginx -v $PWD/www:/www -v $PWD/logs:/wwwlogs -d nginx

 Here are some common commands for docker:

docker ps -a to view all containers

        docker exec -it instance name /bin/bash enter the instance, such as entering tomcat under docker exec -it tomcat /bin/bash 

        If tomcat runs slowly, you need to change the session random of jdk. After entering the instance, cd $JAVA_HOME Enter the Path of JAVA, cd /lib/security vim java.security

        Change this to /dev/./urandom So far, the reason why tomcat is running slowly is solved

        docker inspect instance name to get all the data of the instance

       

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325220107&siteId=291194637