⏚ [:~] % docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos-java latest a669ddb63930 20 hours ago 873.3 MB
debian latest 23cb15b0fcec 5 days ago 125.1 MB
centos latest e9fa5d3a0d0e 8 weeks ago 172.3 MB
⏚ [:~] % docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:5.6
Unable to find image 'mysql:5.6' locally
5.6: Pulling from library/mysql
5971b6ce764f: Pull complete
647b436534ed: Pull complete
a62546ced626: Pull complete
ae83af27a2dd: Pull complete
f707d0b0d5ae: Pull complete
08cc3ca4ae2b: Pull complete
b6e616577480: Pull complete
189e0690d890: Pull complete
8a57c4ca812a: Pulling fs layer
99bdb1211533: Download complete
ffd5c09db2d0: Download complete
09564ce2fbeb: Download complete
5a8727fab22b: Download complete
08a93f567347: Download complete
Pulling repository docker.io/library/mysql
6992b0d06649: Download complete
6d1ae97ee388: Download complete
8b9a99209d5c: Download complete
410c2fae2283: Download complete
e3a6552a83c2: Download complete
1b0e180fd8fa: Download complete
0d5f060b62c4: Download complete
2e8a186e254e: Download complete
1f5ffab9c2a8: Download complete
9b3b492bfd0c: Download complete
5796fe9e2342: Download complete
a3cf6e128b2d: Download complete
e6492c1c9cf6: Download complete
3da706dcd862: Download complete
914669f84a05: Download complete
9b7f82f81b9a: Download complete
Status: Downloaded newer image for mysql:5.6
docker.io/library/mysql: this image was pulled from a legacy registry. Important: This registry version will not be supported in future versions of docker.
548d028caf31872917c22ab4d13d817a2ff593091d4e952729d157765856947f
⏚ [:~] % docker run -it --link some-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"'
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
4cb4f862d994: Pull complete
a7c37483ad01: Pull complete
6838bb2f0679: Pull complete
ca369de2f9aa: Pull complete
61e1545850dc: Pull complete
1dfcc2e5b6c2: Pull complete
8c1c3732f2da: Pull complete
f5f84dea6330: Pull complete
be8cee672400: Pull complete
b01706fbc5a4: Pull complete
Digest: sha256:dde668fcea53f2ac511eda13a32c6ef32f34facbe8d4cd152dd30b27f138fc8b
Status: Downloaded newer image for mysql:latest
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql> exit
Bye