Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker creates a mysql container and saves it as a local image

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Find mirrors on docker hub

[root@wls12c ~] $docker search mysqlNAME DESCRIPTION STARS OFFICIAL AUTOMATEDmysql MySQL is a widely used, open-source relati... 2903 [OK] mysql/mysql-server Optimized MySQL Server Docker images. Crea... 190 [OK] centurylink/mysql Image containing mysql. Optimized to be li... 46 [OK]

Download the image to local

[root@wls12c ~] $docker pull mysql

The default download is officially maintained by docker, which is the first one that search arrives at.

Create a container

The copy code is as follows:

[root@wls12c] $docker run-- name mysqldb-e MYSQL_ROOT_PASSWORD=root-d mysql

-e, specify the environment variable.

Get the IP of mysql image

[root@wls12c ~] $docker inspect mysqldb | grep IPAddress "IPAddress": "172.17.0.4", "SecondaryIPAddresses": null

Connect mysql

[root@wls12c] $mysql-h 172.17.0.4-u root-p

The password is the root specified above

Save the initialized mysql as a mirror

[root@wls12c ~] $docker commit mysqldb mysql:1.03ed4a367c21eb509f1c4e0a772c3e5bdff678497be55700ea256ef34ad87cfc6 [root@wls12c ~] $docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEmysql 1.03ed4a367c21e 3 seconds ago 384.6 MBmysql latest 826df4733292 37 hours ago 384.5 MBcentos latest d83a55af4e75 3 weeks ago 196.7 MBcirros latest d8ca8144dee3 7 months ago 7.735 MB

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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: 265

*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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report