windows10 docker 使用 mysql

來源:互聯網
上載者:User

標籤:通過   password   names   contain   -name   串連資料庫   mysql   定義   bsp   

轉自:http://blog.csdn.net/daocaoren92wq/article/details/68484049
$ docker pull mysql[email protected]:~$ docker pull mysqlUsing default tag: latestlatest: Pulling from library/mysql6d827a3ef358: Pull complete ed0929eb7dfe: Pull complete 03f348dc3b9d: Pull complete fd337761ca76: Pull complete 7e6cc16d464a: Pull complete ca3d380bc018: Pull complete 3fe11378d5c0: Pull complete 2b5dfd325645: Pull complete b54281d17fbe: Pull complete 9a5cfd2d8db6: Pull complete a371b9bf0e19: Pull complete Digest: sha256:b39e58483853ecd03160f9bfdc8d3ecb0be9071fdbbe5484d6a115677b62c84eStatus: Downloaded newer image for mysql:latest[email protected]:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEmysql_ubuntu_0.1 latest c3fb44aa3b0f 10 hours ago 130 MBmysql latest 5faba1a71ec4 8 days ago 407 MBubuntu latest 0ef2e08ed3fa 4 weeks ago 130 MB
  • $ docker run –name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag

–name :自訂容器名 
some-MySQL:容器名字 
-e :設定密碼 
my-secret-pw:資料庫密碼 
-d : 後台執行

-p 連接埠號碼映射

[email protected]:~$ docker run -p 53306: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..."   2 seconds ago       Up 2 seconds              0.0.0.0:53306->3306/tcp   testmysql74d9a010c9b5        mysql               "docker-entrypoint..."   24 minutes ago      Up 6 minutes              3306/tcp                  mysqlb904506516a9        mysql_ubuntu_0.1    "/bin/bash"              10 hours ago        Exited (0) 10 hours ago                             mysql_server9e78e89bdd4a        ubuntu              "/bin/bash"              11 hours ago        Exited (0) 10 hours ago                             kickass_banach

第二個容器是不帶連接埠映射的(-p 53306:3306),外部存取不到 
第一個容器就可以通過 192.168.99.100:53306 串連資料庫

  • 參考
https://hub.docker.com/_/mysql/http://blog.csdn.net/zistxym/article/details/43699029

windows10 docker 使用 mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.