"Step by Step" deploys dotnet core to Docker (medium)

Source: Internet
Author: User
Tags dotnet mysql command line docker ps

Third, run MySQL in Docker

MySQL official also provides various versions of MySQL image for users to use, we can use the following command to create and run a MySQL image:

3306:3306 --name mysqldb-e mysql_root_password=root mysql:latest

Where the-e mysql_root_password specifies the password for the MYSQL ROOT user.

In addition, the available options are: Mysql_root_password, Mysql_database, Mysql_user, Mysql_password, Mysql_allow_empty_password, etc. Specific information can be consulted: https://hub.docker.com/_/mysql/

Ps:mysql Mirror volume is relatively large, due to domestic well-known reasons, we may download very slow, we can use the Daocloud provided by the image accelerator, we need to log on to the official website to register http://www.daocloud.io/, and then to the console, There's an accelerator button above, and it's good to execute the command he gave, probably Curl-ssl https://get.daocloud.io/daotools/set_mirror.sh | Sh-s http//Your Id.m.daocloud.io, it is said that each user each month is 10GB of traffic, generally speaking, enough ~

Verify that you are running MySQL in Docker

After running the above command, after a period of waiting, if normal, the MySQL image is already running.

Method one: Through the MySQL Visual connection tool

We can use the MySQL tool to verify that you directly use the IP of your Linux server, through the 3306 port and root users to access the MySQL database you run in Docker (suddenly feel like to use what database, Docker inside to run an image is good, It's so cool, it's lawless) ~

Method Two: Verify with mysql command line

In addition to the visualizer, we can also use the MySQL command-line tool to verify that our MySQL service is running properly, but since our Docker is running in the container, the shell has been "occupied" by him, we don't care what we knock, he can't use the shell.

    • First, you need to return to the host's Shell interface via the shortcut key: Ctrl+p+q
    • Then we can restart a shell with Docker exec to manipulate the MySQL container that you are running, we first query the container ID of the MySQL container through Docker PS, and then execute the command: Docker exec–it Containerid/bin/bash to create a new shell UI

Use the Docker EXEC command to perform some of the commands in container, where/bin/bash represents the shell program for Linux

    • After entering the shell interface, we use the command mysql-uroot--p to enter the MySQL management interface, after entering the command, the system will prompt you to enter the MySQL root account password, enter the password we set when running this container
    • Enter show databases; commands to query the results of existing database queries in MSYQL are as follows (note that a semicolon must be appended to each command):
    • Finally, we can launch the MySQL management console via the Exit command.

Method Three: Create a new container to access MySQL and verify

This method is probably the same as the method two, we can also use another container, the MySQL command line to operate our database. We need to use the link command to create a direct connection to two containers,

"Step by Step" deploys dotnet core to Docker (medium)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.