Transferred from: http://blog.csdn.net/daocaoren92wq/article/details/68484049
$ docker Pull Mysql[email protected]:~$ docker Pull mysqlusingdefaulttag:latestlatest:Pulling fromlibrary/mysql6d827a3ef358:pull Complete Ed0929eb7dfe:pull complete 03f348dc3b9d:pull complete Fd337761ca76:pull complete 7 E6cc16d464a:pull Complete Ca3d380bc018:pull Complete 3fe11378d5c0:pull complete 2b5dfd325645:pull complete B54281D17FB E:pull Complete 9a5cfd2d8db6:pull Complete a371b9bf0e19:pull complete digest:sha256: b39e58483853ecd03160f9bfdc8d3ecb0be9071fdbbe5484d6a115677b62c84estatus:downloaded Newer image forMysql:latest[email protected]:~$ docker imagesrepository TAG IMAGE ID CREATED sizemysql_ubuntu_0.1Latest c3fb44aa3b0fTenHours ago theMbmysql Latest 5FABA1A71EC48Days ago407Mbubuntu Latest 0EF2E08ED3FA4Weeks ago theMB
- $ docker run–name some-mysql-e mysql_root_password=my-secret-pw-d Mysql:tag
–name: Custom container Name
Some-mysql: Container Name
-E: Set Password
MY-SECRET-PW: Database Password
-D: Background execution
-P Port Number mapping
[Email protected]:~$ Docker run-p53306:3306--name testmysql-e mysql_root_password=123456-d mysql6a38e59ef95d1a3f63a12d9c6c2ae20cf782001f25641f5159812e2a707f3f1d[email protected]:~$ Docker PS-acontainer ID IMAGE COMMAND CREATED STATUS PORTS names6a38e59ef95d MySQL"docker-entrypoint ..." 2Seconds ago Up2Seconds0.0.0.0:53306-3306/TCP testmysql74d9a010c9b5 MySQL"docker-entrypoint ..." -Minutes ago Up6Minutes3306/TCP mysqlb904506516a9 mysql_ubuntu_0.1 "/bin/bash" TenHours ago Exited (0)Tenhours ago mysql_server9e78e89bdd4a Ubuntu"/bin/bash" OneHours ago Exited (0)TenHours ago Kickass_banach
The second container is without port mappings (-P 53,306:3,306), and external access is not
The first container can connect to the database via 192.168.99.100:53306
https://hub.docker.com/_/mysql/http://blog.csdn.net/zistxym/article/details/43699029
WINDOWS10 Docker using MySQL