daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Nov 24th, 2017 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # containerは存在しない
  2. docker container ls -a
  3. CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
  4.  
  5. # 起動
  6. go run main.go
  7. 2017-11-23T02:30:38.881+0900    INFO    workspace/main.go:52    local_docker_db {"status": "starting"}
  8. 2017-11-23T02:30:38.934+0900    DEBUG   workspace/main.go:77    local_docker_db {"container_info": "not_found", "container": "myproject-mysql-db"}
  9. 2017-11-23T02:30:39.428+0900    DEBUG   workspace/main.go:107   local_docker_db {"exec docker cmd": "docker container run --detach --name myproject-mysql-db --publish 3307:3306 --mount type=bind,source=/tmp/docker_db,target=/var/lib/mysql --env MYSQL_USER=gopher --env MYSQL_PASSWORD=golangorgohome --env MYSQL_INITDB_SKIP_TZINFO=yes --env MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:5.6", "stdout": "4a7336c9364b14df0813463161335d8690d9c6e777f5c631bb406b5f55d2e181\n", "stderr": ""}
  10.  
  11. # 確認
  12. mysql -h0.0.0.0 -ugopher -pgolangorgohome --port=3307 -e "show databases" --batch  information_schema
  13. mysql: [Warning] Using a password on the command line interface can be insecure.
  14. Database
  15. information_schema
  16.  
  17. # 既に起動中に、再度起動
  18. go run main.go
  19. 2017-11-23T02:32:34.746+0900    INFO    workspace/main.go:52    local_docker_db {"status": "starting"}
  20. 2017-11-23T02:32:34.830+0900    DEBUG   workspace/main.go:66    local_docker_db {"container_info": "already running", "container": "myproject-mysql-db"}
  21.  
  22. # 一度、停止
  23. docker container stop myproject-mysql-db
  24. myproject-mysql-db
  25.  
  26. # 停止中のcontainerを起動
  27. go run main.go
  28. 2017-11-23T02:35:03.844+0900    INFO    workspace/main.go:52    local_docker_db {"status": "starting"}
  29. 2017-11-23T02:35:03.899+0900    DEBUG   workspace/main.go:94    local_docker_db {"container_info": "exited", "container": "myproject-mysql-db"}
  30. 2017-11-23T02:35:04.289+0900    DEBUG   workspace/main.go:107   local_docker_db {"exec docker cmd": "docker container start 4a7336c9364b", "stdout": "4a7336c9364b\n", "stderr": ""}
  31.  
  32. # 確認
  33.  mysql -h0.0.0.0 -ugopher -pgolangorgohome --port=3307 -e "show databases" --batch  information_schema
  34. mysql: [Warning] Using a password on the command line interface can be insecure.
  35. Database
  36. information_schema
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top