http://blog.csdn.net/u011492260/article/details/77970445
First step: Install Docker: first to the Docker website to download the appropriate version of the current system, and install it (installation process with the installation of QQ almost, not many said). Official website https://www.docker.com. It will prompt you to log off once the installation is complete, but I suggest you do the best with the system, which is the sincere advice of many years old drivers.
Step two: Download the MySQL Image: This time you have a docker chart in the lower right corner of your computer screen (a white whale), then click on the Docker Store, enter MySQL after the website opens, and you should search for more than one result, I chose MySQL (by Docker 10m+), Detailed page in the page to the right will provide installation commands, such as MySQL installation command:
[Plain]View PlainCopy
- Docker pull MySQL
Step three: Create a MySQL instance: when he finishes downloading, you can create a MySQL instance by entering the following command:
[HTML]View PlainCopy
- Docker run--name first-mysql-p 3306:3306-e mysql_root_password=123456-d mysql
Where First-mysql is the instance name, 3306 is the default MySQL port, 123456 is the root password, these you can change yourself, the command after the knock, should appear the following:
Fourth step: Connect MySQL instance: The previous step as long as there is no error, then you successfully created a MySQL instance, then you can use the same database as usual, I use Navicat to connect the newly created instance, you can use the software you used to use or in the code to connect with the database can be There are no special configuration requirements.
At this time, successfully configured Docker in the WIN10 environment, and successfully ran the MySQL instance.
The wise man will continue to see hahaha.
Learning a few Docker commands together will help you to step down a few holes in the future!
First, list all the container (i.e. instance bar) commands in the current local computer Docker:
[Plain]View PlainCopy
- Docker Ps-a
Second, I want to delete an existing container what should be done?
First you have to let the target container stop, and then it can be deleted, for example, I want to stop and delete First-mysql this instance
[Plain]View PlainCopy
- Docker Stop ab8b7a7a468a
- Docker RM ab8b7a7a468a
Enter container_id when entering!
Thirdly, how do I start an existing container? In fact, every time you start Docker, it should automatically start all the existing container, but you really want to learn to start with the command, so
[Plain]View PlainCopy
- Docker start ab8b7a7a468a
That is, Docker start and then the container ID you want to start is OK.
How can I create a database in a new MySQL instance (or container)?
First you go to bash in the instance (container) of MySQL, and the specific command:
[Plain]View PlainCopy
- Docker exec-it Test-mysql Bash
The above command note that this time is not the container ID, but the name of the instance (the instance name we created is called Test-mysql, remember?)
After successfully entering the bash environment, go to MySQL using the following command:
[Plain]View PlainCopy
- Mysql-u root-p
Docker running MySQL