zoukankan      html  css  js  c++  java
  • [Docker] MySQL with spring docket image

    Extending, Securing and Dockerizing Spring Boot Microservices
     
    Final Product requires External MySql Database.
    Install Docker For Mac/Windows/Linux
    #### Docker Commands
    ##### Start MySql Container (downloads image if not found)
    ``
    docker run  --detach   --name ec-mysql -p 6604:3306 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=explorecali -e MYSQL_USER=cali_user -e MYSQL_PASSWORD=cali_pass -d mysql
    ``
    ##### view all images
    ``
    docker images
    ``
    ##### view all containers (running or not)
    ``
    docker ps -a
    ``
    ##### Interact with Database (link to ec-mysql container) with mysql client
    ``
    docker run -it --link ec-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
    ``
    ##### Stop ec-mysql container
    ``
    docker stop ec-mysql
    ``
    ##### (ReStart) ec-mysql container
    ``
    docker start ec-mysql
    ``
    ##### Remove ec-mysql container (must stop it first)
    ``
    docker rm ec-mysql
    ``
    ##### Remove image (must stop and remove container first)
    ``
    docker rmi mysql:latest
    ``

     

  • 相关阅读:
    如何通过Restful API的方式读取SAP Commerce Cloud的Product图片
    Permute Digits
    Browser
    Jamie and Alarm Snooze
    Perfect Squares
    Color the ball
    Stars
    1086. Tree Traversals Again (25)
    1085. Perfect Sequence (25)
    1083. List Grades (25)
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14199203.html
Copyright © 2011-2022 走看看