Docker installation of MySQL in Mac graphics and text tutorial _docker

Source: Internet
Author: User
Tags mkdir mysql in docker run

Today in Docker installed MySQL, is its own Docker pack.

The first new dockerfile content is as follows:

From Mysql:latest

Maintainer Abel.yang <527515025@qq.com>
LABEL descripttion= "This" the image is a for MAC to use MySQL "vendor=" Gi Thub "version=" latest "
run Apt-get update
run apt-get-y install vim
run usermod-u 1000 mysql
run mkdir- P/var/run/mysqld
Run Chmod-r 777/var/run/mysqld

Execute build command after new dockerfile:

Building Mirrors

Docker build-t Mysql/yang.

The build results are as follows:

Enter command to view results

Docker images

Start mirroring

First set up the local data storage address, the data store map to the local computer to prevent data loss. So create a Save data directory, the command is as follows:

Mkdir-p ~/mysql/data

After creating the data directory, the start Mirroring command is as follows.

Docker run-p 3309:3306--name mysqlyang-v ~/mysql/data:/var/lib/mysql-e mysql_root_password=123456-d Mysql/yang

-P 3,309:3,306 Maps Docker 3306 ports to native 3309 ports

V ~/mysql/data:/var/lib/mysql is the/mysql/data that maps the Docker/var/lib/mysql folder to this machine

-e mysql_root_password=123456 Enter password, MYSQL original password is 123456

(If you need to modify the password to execute the docker-exec-it container Id/bin/bash Enter the container to modify the password, you can modify it using the Docker commit container ID new name.) )

Once the container is started, it can be connected using a visual interface. Notice that the exposed port is 3309.

The above is a small set to introduce the Mac Docker install MySQL graphics and text tutorial, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Related Article

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.