Skip to content

Instantly share code, notes, and snippets.

@thanoojgithub
Created September 16, 2024 14:02
Show Gist options
  • Save thanoojgithub/99627382dcf691c9cd81e95c5ca98976 to your computer and use it in GitHub Desktop.
Save thanoojgithub/99627382dcf691c9cd81e95c5ca98976 to your computer and use it in GitHub Desktop.
java -version
docker run hello-world
docker pull mysql
docker images
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest 680b8c60dce6 7 weeks ago 586MB
hello-world latest d2c94e258dcb 16 months ago 13.3kB
thanooj@debian12:~$ docker run -e MYSQL_ROOT_PASSWORD=pass -d mysql
e6839fde91eb6793ef3d7adb84e528aa2f03370ca846a495af811aac0c484033
thanooj@debian12:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6839fde91eb mysql "docker-entrypoint.s…" 8 seconds ago Up 7 seconds 3306/tcp, 33060/tcp laughing_heyrovsky
thanooj@debian12:~$
docker inspect laughing_heyrovsky
thanooj@debian12:~$ docker inspect laughing_heyrovsky
[
{
"Id": "e6839fde91eb6793ef3d7adb84e528aa2f03370ca846a495af811aac0c484033",
"Created": "2024-09-15T12:49:18.748802329Z",
"Path": "docker-entrypoint.sh",
"Args": [
"mysqld"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 26634,
"ExitCode": 0,
"Error": "",
"StartedAt": "2024-09-15T12:49:19.182485535Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:680b8c60dce62c25af20deda8764e29191709a4495b116f6b4d655061d3bd8ff",
"ResolvConfPath": "/var/lib/docker/containers/e6839fde91eb6793ef3d7adb84e528aa2f03370ca846a495af811aac0c484033/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/e6839fde91eb6793ef3d7adb84e528aa2f03370ca846a495af811aac0c484033/hostname",
"HostsPath": "/var/lib/docker/containers/e6839fde91eb6793ef3d7adb84e528aa2f03370ca846a495af811aac0c484033/hosts",
"LogPath": "/var/lib/docker/containers/e6839fde91eb6793ef3d7adb84e528aa2f03370ca846a495af811aac0c484033/e6839fde91eb6793ef3d7adb84e528aa2f03370ca846a495af811aac0c484033-json.log",
"Name": "/laughing_heyrovsky",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "bridge",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"ConsoleSize": [
47,
211
],
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "private",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": [],
"BlkioDeviceWriteBps": [],
"BlkioDeviceReadIOps": [],
"BlkioDeviceWriteIOps": [],
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": null,
"PidsLimit": null,
"Ulimits": [],
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware",
"/sys/devices/virtual/powercap"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/aa4139b820180d59ad1bb2b99fb203edd9806adbe4dcc18eb235d2170fdbcc55-init/diff:/var/lib/docker/overlay2/5efb6b11e3453e23ad53bf299a8ed32eb006d143d5ac459c66ab39cbf707e186/diff:/var/lib/docker/overlay2/190ae6e581970f5664c127e5ace60fe44b1b36cf32b7d7d9e6365143e8313df6/diff:/var/lib/docker/overlay2/6b37dec13dd1b2bfc6c6d9282f6a9b243590033492d92a61f21700e7ccdafd3d/diff:/var/lib/docker/overlay2/f16670ca27418873afb93ff2e30729570f76d0c254fceae17e9c0534a540a192/diff:/var/lib/docker/overlay2/34fb02d1bd6e8eb662f05cf0e01c3198c5c5c900c9747d85181713df3f2c0649/diff:/var/lib/docker/overlay2/6de5206e49a04b529d9bfa20de24fd9f01c6d523be3d7cd31ad2aa750fd29bc6/diff:/var/lib/docker/overlay2/ef78540da32688de7c8ed099cc23cb75f7ab80555933ddaf692e1a854bea639d/diff:/var/lib/docker/overlay2/eade8a81b8bf075eced0cd87cf9b5d20ec19dbb99e773ab118ab8334e5f1c5e1/diff:/var/lib/docker/overlay2/8f3a5111a11ba4d36792184a24555c3ee14b9f1a0f0060696481cab70e1fefe9/diff:/var/lib/docker/overlay2/96af086523b2b75ee34e8c04321eaf5b0e2c007a43aca24dfdf3ec882169456d/diff",
"MergedDir": "/var/lib/docker/overlay2/aa4139b820180d59ad1bb2b99fb203edd9806adbe4dcc18eb235d2170fdbcc55/merged",
"UpperDir": "/var/lib/docker/overlay2/aa4139b820180d59ad1bb2b99fb203edd9806adbe4dcc18eb235d2170fdbcc55/diff",
"WorkDir": "/var/lib/docker/overlay2/aa4139b820180d59ad1bb2b99fb203edd9806adbe4dcc18eb235d2170fdbcc55/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "c3e19faf9c4bdaa7c349fe81509254508ebc39ce21207e34e7464cff087b34f5",
"Source": "/var/lib/docker/volumes/c3e19faf9c4bdaa7c349fe81509254508ebc39ce21207e34e7464cff087b34f5/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "e6839fde91eb",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_ROOT_PASSWORD=pass",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.17",
"MYSQL_MAJOR=innovation",
"MYSQL_VERSION=9.0.1-1.el9",
"MYSQL_SHELL_VERSION=9.0.1-1.el9"
],
"Cmd": [
"mysqld"
],
"Image": "mysql",
"Volumes": {
"/var/lib/mysql": {}
},
"WorkingDir": "/",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "db251c25591b0846029362f5c6e0589a159607f1b0c32deec5e7068b0fabd45d",
"SandboxKey": "/var/run/docker/netns/db251c25591b",
"Ports": {
"3306/tcp": null,
"33060/tcp": null
},
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "551d29a3866ba9dcd0a647d7731406bc2ac3412ef4b84ca5bf4e810e70f6072d",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null,
"NetworkID": "c1042496d097099a43d739c6ea75035ec6d54c9e2d0a9239c08a49eca3a59bf9",
"EndpointID": "551d29a3866ba9dcd0a647d7731406bc2ac3412ef4b84ca5bf4e810e70f6072d",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"DNSNames": null
}
}
}
}
]
thanooj@debian12:~$
thanooj@debian12:~$ docker inspect laughing_heyrovsky | grep "IPAddress"
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
thanooj@debian12:~$
bash-5.1# mysql -h 172.17.0.2 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 9.0.1 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
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>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
mysql> create database mydb;
Query OK, 1 row affected (0.02 sec)
mysql> use mydb;
Database changed
mysql> show tables;
Empty set (0.00 sec)
thanooj@debian12:~$ docker pull dbeaver/cloudbeaver
Using default tag: latest
latest: Pulling from dbeaver/cloudbeaver
9c704ecd0c69: Pull complete
1ecaf9f47d12: Pull complete
f771417f3e38: Pull complete
e74eee18d850: Pull complete
4f4fb700ef54: Pull complete
9707be7b4365: Pull complete
f5f9bef6d4d4: Pull complete
Digest: sha256:1cfdda9878750e11d854c514562143cda73ea32c58507f9ce6960d4db118b813
Status: Downloaded newer image for dbeaver/cloudbeaver:latest
docker.io/dbeaver/cloudbeaver:latest
thanooj@debian12:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
dbeaver/cloudbeaver latest ca79ef87e1b5 3 days ago 670MB
mysql latest 680b8c60dce6 7 weeks ago 586MB
hello-world latest d2c94e258dcb 16 months ago 13.3kB
thanooj@debian12:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3d65435b188f mysql "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 3306/tcp, 33060/tcp keen_yonath
e6839fde91eb mysql "docker-entrypoint.s…" 20 minutes ago Up 20 minutes 3306/tcp, 33060/tcp laughing_heyrovsky
thanooj@debian12:~$
thanooj@debian12:~$
docker run --name cloudbeaver-ee --rm -ti -p 8080:8978 -v /opt/cloudbeaver/workspace dbeaver/cloudbeaver:latest -d --restart unless-stopped
create user cbadmin with new password
and then,
http://localhost:8080/#/
172.17.0.2:3306
jdbc:mysql://172.17.0.2:3306/mysql
root
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment