1
- ![ latest 0.1 .0] ( https://img.shields.io/badge/latest-0.1 .0-green.svg?style=flat )
1
+ ![ latest 0.2 .0] ( https://img.shields.io/badge/latest-0.2 .0-green.svg?style=flat )
2
2
[ ![ license] ( https://img.shields.io/github/license/webcore/snitcher.svg?maxAge=2592000 )] ( https://opensource.org/licenses/MIT )
3
3
4
4
# Docker DB tunnel
@@ -26,17 +26,58 @@ Run shell script to create network, sshd container and connect all db containers
26
26
$ ./docker-db-tunnel.sh
27
27
Creating db tunnel network: db-tunnel-network
28
28
668e40197c800a612ea748b9778d3f0888333673f7588d4a0bb1e027bd5d22d4
29
- Running db tunnel container with name: db-tunnel-sshd
29
+ Running db tunnel container db-tunnel-sshd on port 22666
30
30
164e5a3c3b446169f928a03c135594493843664fef5ffa3edf820dd5de06f0a1
31
31
Connecting symfony-demo_mariadb_1 to db-tunnel-network
32
32
Connecting symfony-demo2_mariadb_1 to db-tunnel-network
33
- Connecting project_mysql_1 to db-tunnel-network
33
+ Connecting project_mysql_1 to db-tunnel-network with hostname (alias) project_db_host
34
34
```
35
35
36
- ### SSH Tunnel options
37
- The ** root** password for SSH is "** root** ". How to [ change-root-password] ( https://github.com/sickp/docker-alpine-sshd#change-root-password ) .
36
+ ### Docker-compose services example
37
+
38
+ docker-compose-project.yml
39
+ ``` yaml
40
+ services :
41
+ project_mysql :
42
+ container_name : project_mysql_1
43
+ image : mariadb
44
+ environment :
45
+ - MYSQL_ALLOW_EMPTY_PASSWORD=yes
46
+ labels :
47
+ - db.network.tunnel.hostname=project_db_host
48
+ network_mode : " bridge"
49
+ ` ` `
50
+
51
+ docker-compose-symfony-demo.yml
52
+ ` ` ` yaml
53
+ services :
54
+ symfony-demo_mariadb :
55
+ container_name : symfony-demo_mariadb_1
56
+ image : mariadb
57
+ environment :
58
+ - MYSQL_ALLOW_EMPTY_PASSWORD=yes
59
+ network_mode : " bridge"
60
+ ` ` `
61
+
62
+ ### SSH Tunnel settings
63
+ The **root** password for SSH is in ` sickp/alpine-sshd` "**root**".
64
+ You can also [change default root password](https://github.com/sickp/docker-alpine-sshd#change-root-password).
65
+
66
+ # ## Connection settings example
67
+
68
+ ```
69
+ MySQL host: project_mysql_1
70
+ # or via alias
71
+ # MySQL host: project_db_host
72
+ Username: root
73
+ Port: 3306
74
+
75
+ SSH Host: 127.0.0.1
76
+ SSH User: root
77
+ SSH Password: root
78
+ SSH Port: 22666
79
+ ```
38
80
39
- ### Sequel Pro connection details
40
81

41
82
42
83
## Customize
@@ -45,6 +86,7 @@ It is easy to extend via your own .env file:
45
86
46
87
```dotenv
47
88
DB_TUNNEL_NETWORK=db-tunnel-network
89
+ DB_TUNNEL_NETWORK_HOSTNAME_LABEL=db.network.tunnel.hostname
48
90
DB_TUNNEL_CONTAINER_NAME=db-tunnel-sshd
49
91
DB_TUNNEL_CONTAINER_PORT=22666
50
92
DB_CONTAINER_NAME_PATTERN="mariadb|mysql" #pattern for docker ps filtering
0 commit comments