[root@localhost ~]# docker exec -it first-mssql bash
root@38c3504d5c71:/# /opt/mssql-tools/bin/sqlcmd -S localhost -U SA
Password:
1> create database test_db
2> go
1> select name from sys.databases
2> go
name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
test_db
(5 rows affected)
1> use test_db
2> go
Changed database context to 'test_db'.
1> create table staff(id int,name nvarchar(50))
2> go
1> insert into staff(id,name) values(1,'Monk')
2> go
(1 rows affected)
1> select * from staff
2> go
id name
----------- --------------------------------------------------
1 Monk
(1 rows affected)
1>
[root@localhost ~]# docker run --name first-mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 -d mysql
456619e7a1a7616a8b0e7cd720df00a0dc5afbbbafe0065dd8cd0f7a5b250e7a
[root@localhost ~]# docker container ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
456619e7a1a7 mysql "docker-entrypoint.s…" 7 seconds ago Up 6 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp first-mysql
[root@localhost ~]#
[root@localhost ~]# docker exec -it first-mysql bash
root@456619e7a1a7:/# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> create database test_db;
Query OK, 1 row affected (0.00 sec)
mysql> use test_db;
Database changed
mysql> create table staff(id int,name nvarchar(50))
-> ;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> insert into staff(id,name) values(1,'Monk');
Query OK, 1 row affected (0.01 sec)
mysql> select * from staff;
+------+------+
| id | name |
+------+------+
| 1 | Monk |
+------+------+
1 row in set (0.00 sec)
mysql>
[root@localhost ~]# docker exec -it first-nginx bash
root@48817f1d0fbe:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@48817f1d0fbe:/# cd etc/nginx
root@48817f1d0fbe:/etc/nginx# ls
conf.d fastcgi_params koi-utf koi-win mime.types modules nginx.conf scgi_params uwsgi_params win-utf
root@48817f1d0fbe:/etc/nginx#