In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
As the most popular technology today, Docker has increasingly become a must-have skill for developers. It allows us to quickly build the required application environment, such as redis, mq, tomcat, zookeeper, mysql, nginx images. Here I summarize how to use it, so that you can link these knowledge points together in an article.
Pull the image
At present, what I commonly use is the domestic mirror image of NetEase, and the download speed is very fast.
# docker pull hub.c.163.com/library/rabbitmq-pull mq from NetEase image
# docker pull hub.c.163.com/library/tomcat:latest-pull from NetEase to tomcat
# docker pull hub.c.163.com/library/nginx-pull nginx from NetEase
# docker pull rabbitmq:3-management-this version has a background display to see the monitoring page
# docker pull hub.c.163.com/library/redis-pull redis from NetEase
# docker pull hub.c.163.com/library/elasticsearch-pull elasticsearch from NetEase
# docker pull hub.c.163.com/library/zookeeper-pull zookeeper from NetEase
# docker pull hub.c.163.com/library/mysql-pull mysql from NetEase
2 View the image
Check the image after pulling it down to get the image id:
# docker images-View the pulled image
3 start mirroring
Starting an image is a very critical step. The startup commands of each image that does not need to be applied are different, mainly the port mapping. The following are all tried images that can be started successfully:
# docker run-d-name "xdclass_nginx"-p 8088 nginx 80 nginx-start nginx
# docker run-d-name "xdclass_rabbitmq"-p 5672 xdclass_rabbitmq-p 15672 db695e07d0d
-- running mq;-d is running in the background;-p is the specified port mapping
# docker run-d-- name xdclass_redis-p 6379d4f259423416 6379 d4f259423416-- start the redis container, but the actual redis is not started
# docker exec-it ce388f800aed redis-cli-docker is followed by the container number after accessing the startup redis,it.
# docker run-d-- name myzookeeper-p 2181 restart always 5e8e3d7b06f9-- start the zookeeper image
# docker run-p 3306 PWD/conf:/etc/mysql/conf.d 3306-- name mysql-v $PWD/conf:/etc/mysql/conf.d-v $PWD/logs:/logs-v $PWD/data:/var/lib/mysql-e MYSQL_ROOT_PASSWORD=rootroot-d 9e64176cd8a2. -docker Boot mysql,MYSQL_ROOT_PASSWORD is followed by the default root password of the startup setting.
4 check that the container has been started
# docker ps-a-view all containers, including those that have been started and those that have not been started
# docker ps. -View the containers that have been started.
5 follow-up operation of Mysql
After the Mysql container is started, if you want to connect through clients such as navicat, you also need to activate remote login permission. Here are the steps:
First, after the mysql container has been launched above, enter the container:
# docker exec-it c8486ec93afb bash
Step 2, log in to mysql:
# mysql-u root-p-the password rootroot of the previous docker run will be prompted in the middle
Step 3: add permission to access mysql remotely:
Mysql > grant all privileges on. To root@'%' identified by 'rootroot' with grant option
Mysql > flush privileges
Note: user name of the newly set remote access: root, password: rootroot
6 stop and restart Container commands
# docker stop 283138f62bc2-stop the container, container number: 283138f62bc2
# docker start 283138f62bc2-launch the established container number: 283138f62bc2
# docker stop $(docker ps-a-Q)-stop stops all containers
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.