uewolf25 / docker-study Goto Github PK
View Code? Open in Web Editor NEWDockerの勉強会用の素材だよ☆
License: MIT License
Dockerの勉強会用の素材だよ☆
License: MIT License
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
wolf25 mysql $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f85bd2145374 mysql:5.7 "docker-entrypoint.s…" 3 hours ago Exited (0) 7 seconds ago mysql_login_only
6552b954b3f0 jupyter/datascience-notebook "tini -g -- /usr/loc…" 8 weeks ago Exited (0) 3 hours ago anaconda3_mmc
wolf25 mysql $ docker rm f85
f85
wolf25 mysql $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6552b954b3f0 jupyter/datascience-notebook "tini -g -- /usr/loc…" 8 weeks ago Exited (0) 3 hours ago anaconda3_mmc
wolf25 mysql $ docker run --name mysql_login_only -e MYSQL_ROOT_PASSWORD=pass -d -p 3000:3000 mysql:5.7
0e1dc5ebc01d27bcc8e7760a2e5a163644378325d2fa20ae01e50ccd3b8f4b8e
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0e1dc5ebc01d mysql:5.7 "docker-entrypoint.s…" 3 seconds ago Up 2 seconds 3306/tcp, 0.0.0.0:3000->3000/tcp, 33060/tcp mysql_login_only
wolf25 mysql $ docker exec -it 0e1 bash
root@0e1dc5ebc01d:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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 |
| sys |
+--------------------+
4 rows in set (0.01 sec)
イメージからコンテナ起動してMySQLにログイン。
簡単なレコード操作からコンテナ終了まで。
wolf25 mysql $ docker pull mysql:5.7
5.7: Pulling from library/mysql
bf5952930446: Pull complete
8254623a9871: Pull complete
938e3e06dac4: Pull complete
ea28ebf28884: Pull complete
f3cef38785c2: Pull complete
894f9792565a: Pull complete
1d8a57523420: Pull complete
5f09bf1d31c1: Pull complete
1591b28581e8: Pull complete
96ef942f7603: Pull complete
2e009731422e: Pull complete
Digest: sha256:1a83136153b238b659b0887ceb4e08275473af1eab2e67de4c22b37c5f4130cd
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7
wolf25 mysql $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 d589ea3123e0 3 days ago 448MB
docker_python3 latest d0959f512d42 2 months ago 1.17GB
jupyter/datascience-notebook latest a5cc93205668 2 months ago 5.22GB
ksu-navi4 latest b06a55d0cda4 2 months ago 1.78GB
excel_do_python3 latest b2c349628350 2 months ago 1.13GB
python 3.6.10 13efce2de907 3 months ago 914MB
ksu-navi4 1 f078fdaa9b85 3 months ago 1.78GB
ubuntu 18.04 c3c304cb4f22 4 months ago 64.2MB
continuumio/anaconda3 2020.02 bdb4a7e92a49 5 months ago 2.7GB
paperist/alpine-texlive-ja latest af19d171edd4 7 months ago 1.06GB
php 7.1-apache a51743213f98 15 months ago 369MB
php_apache_image ver001 a51743213f98 15 months ago 369MB
fenrir_app latest 3d51c01840e8 15 months ago 378MB
php 7.2-apache c6f57b17bf9f 15 months ago 378MB
nginx 1.15 8c9ca4d17702 18 months ago 109MB
nginx latest 8c9ca4d17702 18 months ago 109MB
mysql <none> e47e309f72c8 19 months ago 372MB
node 10.15 8fc2110c6978 19 months ago 897MB
python 3.6.4 336d482502ab 2 years ago 692MB
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
wolf25 mysql $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6552b954b3f0 jupyter/datascience-notebook "tini -g -- /usr/loc…" 8 weeks ago Exited (0) 29 minutes ago anaconda3_mmc
wolf25 mysql $ docker run --name mysql_login_only -e MYSQL_ROOT_PASSWORD=pass -d -p 3000:3000 mysql:5.7
f85bd21453746d5fdf4762d7479463cc95fc0ed6388e9d6d91c1bebab4da0cc3
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f85bd2145374 mysql:5.7 "docker-entrypoint.s…" 4 seconds ago Up 3 seconds 3306/tcp, 0.0.0.0:3000->3000/tcp, 33060/tcp mysql_login_only
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f85bd2145374 mysql:5.7 "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 3306/tcp, 0.0.0.0:3000->3000/tcp, 33060/tcp mysql_login_only
wolf25 mysql $ docker exec -it f85 bash
root@f85bd2145374:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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> .database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.database' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> create databese test;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databese test' at line 1
mysql> create database test;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> use test;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> show table status;
Empty set (0.00 sec)
mysql> create table test_table(
-> id int(10) auto_increment not null,
-> name varchar(32) not null,
-> primary key (id)
-> );
Query OK, 0 rows affected (0.02 sec)
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| test_table |
+----------------+
1 row in set (0.00 sec)
mysql> insert into test_table (name) values ("hoge");
Query OK, 1 row affected (0.01 sec)
mysql> insert into test_table (name) values ("foooooo");
Query OK, 1 row affected (0.00 sec)
mysql> select * from test_table;
+----+---------+
| id | name |
+----+---------+
| 1 | hoge |
| 2 | foooooo |
+----+---------+
2 rows in set (0.00 sec)
mysql> delete from test_table where id=1;
Query OK, 1 row affected (0.01 sec)
mysql> select * from test_table;
+----+---------+
| id | name |
+----+---------+
| 2 | foooooo |
+----+---------+
1 row in set (0.00 sec)
mysql> ^DBye
root@f85bd2145374:/# exit
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f85bd2145374 mysql:5.7 "docker-entrypoint.s…" About an hour ago Up About an hour 3306/tcp, 0.0.0.0:3000->3000/tcp, 33060/tcp mysql_login_only
wolf25 mysql $ docker stop f85
f85
wolf25 mysql $ docker-compose up -d
Creating network "mysql_default" with the default driver
Creating mysql_sample ... done
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b27ce2c8495b mysql:5.7 "docker-entrypoint.s…" 6 seconds ago Up 5 seconds 3306/tcp, 0.0.0.0:3000->3000/tcp, 33060/tcp mysql_sample
wolf25 mysql $ docker exec -it b27 bash
root@b27ce2c8495b:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| test_table |
+----------------+
1 row in set (0.00 sec)
mysql> select * from test_table;
Empty set (0.00 sec)
mysql> INSERT INTO test_table (name) VALUES ("hoge");
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO test_table (name) VALUES ("fuuuuuuuuu");
Query OK, 1 row affected (0.00 sec)
mysql> select * from test_table;
+----+------------+
| id | name |
+----+------------+
| 1 | hoge |
| 2 | fuuuuuuuuu |
+----+------------+
2 rows in set (0.01 sec)
mysql> ^DBye
root@b27ce2c8495b:/# exit
wolf25 mysql $ docker-compose down
Stopping mysql_sample ... done
Removing mysql_sample ... done
Removing network mysql_default
wolf25 mysql $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6552b954b3f0 jupyter/datascience-notebook "tini -g -- /usr/loc…" 8 weeks ago Exited (0) 4 hours ago anaconda3_mmc
wolf25 mysql $ docker-compose up -d
Creating network "mysql_default" with the default driver
Creating mysql_sample ... done
wolf25 mysql $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a5e91182f715 mysql:5.7 "docker-entrypoint.s…" 22 seconds ago Up 20 seconds 3306/tcp, 0.0.0.0:3000->3000/tcp, 33060/tcp mysql_sample
wolf25 mysql $ docker exec -it a5e bash
root@a5e91182f715:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| test_table |
+----------------+
1 row in set (0.01 sec)
mysql> select * from test_table;
+----+------------+
| id | name |
+----+------------+
| 1 | hoge |
| 2 | fuuuuuuuuu |
+----+------------+
2 rows in set (0.00 sec)
mysql> ^DBye
root@a5e91182f715:/# exit
wolf25 mysql $ logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...467 completed.
[プロセスが完了しました]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.