In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly tells you how to create a Centos Docker image through Dockerfile. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on how to create a Centos Docker image through Dockerfile can bring you some practical help.
1. After entering Linux, use the Docker command to download MySQL, such as:
Docker pull mysql:5.7
After running the command, the following logs are displayed:
[root@localhost ~] # docker pull mysql:5.75.7: Pulling from library/mysqlad74af05f5a2: Pull complete 0639788facc8: Pull complete de70fa77eb2b: Pull complete 724179e94999: Pull complete 50c77fb16ba6: Pull complete d51f459239fb: Pull complete 937bbdd4305a: Pull complete 35369f9634e1: Pull complete f6016aab25f1: Pull complete 5f1901e920da: Pull complete fdf808213c5b: Pull complete Digest: sha256:96edf37370df96d2a4ee1715cc5c7820a0ec6286551a927981ed50f0273d9b43Status: Downloaded newer image for mysql:5.7
2. Check which images are available on this machine first. The command is as follows:
Docker images [root@localhost ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEmysql 5.7 c73c7527c03a 8 days ago 412MBhello-world latest 1815c82652c0 7 weeks ago 1.84kBjava latest d23bdf5b1b1b 6 months ago 643MBlearn/tutorial latest a7876479f1aa 4 years ago 128MB
3. Then start our docker container for mysql with the following command:
Docker run-- name mysql5.7-p 3306 MYSQL_ROOT_PASSWORD=123456-d mysql:5.7
Note that the name of the container here is: the root user password of mysql5.7,mysql is: 123456. Map the port 3306 of the host to the port 3306 of the container. The warehouse name mysql and the tag (tag) only determine the image to be specified. In fact, if there is only one mysql, it is necessary to tag. The result returned by executing this command is:
9238d9feb10a0c553d950451add144727b659a0972ccf04d7c59c3bfa198ed20
4. View all containers that have been run, such as: docker ps
[root@localhost ~] # docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES9238d9feb10a mysql:5.7 "docker-entrypoint..." 12 seconds ago Up 9 seconds 0.0.0.0 docker-entrypoint... 3306-> 3306/tcp mysql5.7 [root@localhost ~] #
5. Tools that use mysql, such as navicat, successfully connect as follows:
How to create a Centos Docker image through Dockerfile will first tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.
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.