The below steps will add Docker’s official repository and GPG key, install Docker and the Compose plugin. This will let me run Docker without the need for sudo
.
1. Update apt and install prerequisites
$ sudo apt update
$ sudo apt install -y ca-certificates curl gnupg lsb-release
2. Add Docker’s official GPG key
$ sudo install -m 0755 -d /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
3. Add Docker repo (detects arm64 automatically)
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/debian $(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4. Install Docker and Compose plugin
$ sudo apt update
$ sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
5. Let your user run Docker without sudo
$ sudo usermod -aG docker $USER
$ newgrp docker
6. Create a MySQL 8.4 LTS container
Use docker‑compose
so the config lives inside a single, configurable file.
Creating a directory in my home directory MySQL stack
$ mkdir -p ~/mysql-docker
$ cd ~/mysql-docker
Create a file called docker-compose.yml
$ vim docker-compose.yml
Append the below configurations. This will create a container called mysql8
.
Also change password in text below. Set to “changeme_user
“
version: "3.9"
services:
mysql:
image: mysql:8.4
container_name: mysql8
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: <changeme_root>
MYSQL_DATABASE: telemetry
MYSQL_USER: bill
MYSQL_PASSWORD: <changeme_user>
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./config:/etc/mysql/conf.d:ro
volumes:
mysql_data:
Notes:
- Change passwords before first run.
volumes
: ensures data survives container restarts or image updates../config
is where you can drop.cnf
overrides (e.g., timezone, buffer pool).- This file is architecture‑safe — Docker pulls the ARM64 image automatically.
7. Start MySQL via the Docker process
Go to the docker folder
$ cd ~/mysql-docker
Start the Docker compose.
$ docker compose up -d
Output…
$ docker compose up -d
WARN[0000] /home/user/mysql-docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 11/11
✔ mysql Pulled 37.5s
✔ da99ef17bcd1 Pull complete 6.6s
✔ bc12642f0976 Pull complete 6.6s
✔ 739cdd12ec77 Pull complete 6.7s
✔ d7e901e4e4c1 Pull complete 7.0s
✔ 19592870864a Pull complete 7.0s
✔ 7bc39bf601a8 Pull complete 7.1s
✔ 5ef658516113 Pull complete 13.5s
✔ 3cd4c1e6baf0 Pull complete 13.6s
✔ 5688f8e7baa3 Pull complete 33.6s
✔ 17c46015e74a Pull complete 33.7s
[+] Running 3/3
✔ Network mysql-docker_default Created 0.1s
✔ Volume "mysql-docker_mysql_data" Created 0.0s
✔ Container mysql8 Started 21.9s
$
Check Docker is running.
- Looking for
mysql8 with 0.0.0.0:3306->3306/tcp
- Looking for ready for connections
$ docker ps
$ docker logs mysql8 --tail 20
Output…
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0197dc5bad4d mysql:8.4 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:3306->3306/tcp, [::]:3306->3306/tcp, 33060/tcp mysql8
$
$ docker logs mysql8 --tail 20
2025-08-18 07:14:28+00:00 [Note] [Entrypoint]: Creating user bill
2025-08-18 07:14:28+00:00 [Note] [Entrypoint]: Giving user bill access to schema telemetry
2025-08-18 07:14:28+00:00 [Note] [Entrypoint]: Stopping temporary server
2025-08-18T07:14:28.753094Z 13 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.4.6).
2025-08-18T07:14:31.210986Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.6) MySQL Community Server - GPL.
2025-08-18T07:14:31.211091Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2025-08-18 07:14:31+00:00 [Note] [Entrypoint]: Temporary server stopped
2025-08-18 07:14:31+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2025-08-18T07:14:31.778623Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-08-18T07:14:31.964787Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.6) starting as process 1
2025-08-18T07:14:31.970507Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-08-18T07:14:33.158802Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-08-18T07:14:33.528257Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-08-18T07:14:33.528291Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-08-18T07:14:33.532688Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2025-08-18T07:14:33.569697Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2025-08-18T07:14:33.569872Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.6' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
$
Connect to MySQL and Integrate with other apps
Check Docker health
$ docker ps
$ docker logs -f mysql8
$ docker inspect --format='{{.State.Health.Status}}' mysql8
Check MySQL health
$ docker exec mysql8 mysqladmin ping -u bill -p
Create an alias in ~/.bashrc called “mysqlcli” to avoid long command strings to access MySQL.
# Alias DOCKER for my MySQL8 DB
alias mysqlcli='docker exec -it mysql8 mysql -u bill -p'
Running this command will get you into MySQL8
$ mysqlcli
Enter password:<password>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.4.6 MySQL Community Server - GPL
Copyright (c) 2000, 2025, 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>