【docker基础】之安装MySQL

查看本地是否已经安装

docker images
# 输出
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              bf756fb1ae65        11 months ago       13.3kB

查看可用版本

docker search mysql
# 输出
NAME                              DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
mysql                             MySQL is a widely used, open-source relation…   10202               [OK]              
mariadb                           MariaDB is a community-developed fork of MyS…   3753                [OK]              
mysql/mysql-server                Optimized MySQL Server Docker images. Create…   746                                     [OK]
percona                           Percona Server is a fork of the MySQL relati…   511                 [OK]              
centos/mysql-57-centos7           MySQL 5.7 SQL database server                   86                                    
mysql/mysql-cluster               Experimental MySQL Cluster Docker images. Cr…   78                                    
centurylink/mysql                 Image containing mysql. Optimized to be link…   60                                      [OK]
bitnami/mysql                     Bitnami MySQL Docker Image                      47                                      [OK]
deitch/mysql-backup               REPLACED! Please use http://hub.docker.com/r…   41                                      [OK]
tutum/mysql                       Base docker image to run a MySQL database se…   35                                    
databack/mysql-backup             Back up mysql databases to... anywhere!         33                                    
prom/mysqld-exporter                                                              32                                      [OK]
schickling/mysql-backup-s3        Backup MySQL to S3 (supports periodic backup…   29                                      [OK]
linuxserver/mysql                 A Mysql container, brought to you by LinuxSe…   26                                    
centos/mysql-56-centos7           MySQL 5.6 SQL database server                   20                                    
circleci/mysql                    MySQL is a widely used, open-source relation…   19                                    
mysql/mysql-router                MySQL Router provides transparent routing be…   17                                    
arey/mysql-client                 Run a MySQL client from a docker container      16                                      [OK]
fradelg/mysql-cron-backup         MySQL/MariaDB database backup using cron tas…   10                                      [OK]
openshift/mysql-55-centos7        DEPRECATED: A Centos7 based MySQL v5.5 image…   6                                     
devilbox/mysql                    Retagged MySQL, MariaDB and PerconaDB offici…   3                                     
ansibleplaybookbundle/mysql-apb   An APB which deploys RHSCL MySQL                2                                       [OK]
widdpim/mysql-client              Dockerized MySQL Client (5.7) including Curl…   1                                       [OK]
jelastic/mysql                    An image of the MySQL database server mainta…   1                                     
monasca/mysql-init                A minimal decoupled init container for mysql    0 

拉取最新镜像

docker pull mysql:latest
# 输出
latest: Pulling from library/mysql
852e50cd189d: Pull complete                                                                                             29969ddb0ffb: Pull complete                                                                                             a43f41a44c48: Pull complete                                                                                             5cdd802543a3: Pull complete                                                                                             b79b040de953: Pull complete                                                                                             938c64119969: Pull complete                                                                                             7689ec51a0d9: Pull complete                                                                                             a880ba7c411f: Pull complete                                                                                             984f656ec6ca: Pull complete                                                                                             9f497bce458a: Pull complete                                                                                             b9940f97694b: Pull complete                                                                                             2f069358dc96: Pull complete                                                                                             Digest: sha256:4bb2e81a40e9d0d59bd8e3dc2ba5e1f2197696f6de39a91e90798dd27299b093
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest

启动 MySQL

docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
上一篇:用Dockerfile来build原理和过程


下一篇:一个轻量级的JetPackMVVMLight