In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to create a Mysql container in Docker, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
The steps are as follows
1. Start the docker service
[root@docker ~] # systemctl start docker
2. View the images in docker
[root@docker ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEcentos/mysql-57-centos7 latest 2e4ddfafaa6f 6 months ago 445MBgogs/gogs latest 2fb3b88053d6 6 months ago 94.2MB
3. Search the name of the image you want to query
[root@docker] # docker search mysqlNAME DESCRIPTION STARS OFFICIAL AUTOMATEDmysql MySQL is a widely used, open-source relation... 7854 [OK] mariadb MariaDB is a community-developed fork of MyS... 2604 [OK] cloudfoundry/cf-mysql-ci Image used in CI of cf-mysql-release 0 [root@localhost ~] # docker pull mysql- download the latest version by default [root@localhost ~] # docker pull mysql:5.7- download the specified version
4. Create and run a mysql container
[root@docker ~] # docker run-di-- name=test_mysql-p 3306 di 3306-e MYSQL_ROOT_PASSWORD=root centos/mysql-57-centos7d7e5f99b502a904a970026e90227e186107e3b5d0baeaa93491af12cd7317b99run: create and run-di: create in Guardian mode-- name: give the container a name-p: Port mapping-e: initialize the Mysql user and set the root password to root
The name of the image is filled in at last. If you do not specify the version, the latest one will be created by default.
5. View the running container
[root@docker ~] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESd7e5f99b502a centos/mysql-57-centos7 "container-entrypoin …" 5 seconds ago Up 4 seconds 0.0.0.03306/tcp test_mysql 3306-> 3306/tcp test_mysql
6. You can use database tools to connect to the database in the virtual machine on your own computer.
IP is the IP that connects to the virtual machine. Account: root, password: root
7. In fact, as long as you can pull an image, the others are more or less the same (such as redis,mogodb,rabbitmq, etc.)
The above is how to create a Mysql container in Docker. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.