Note: this is for local instalation only. if for production environtment, you can custom set for better security.

#install docker
sudo apt install docker.io

#create mysql container and database
$ docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=password -p 33060:3306 mysql
$ mysql --host=127.0.0.1 --port=33060 -u root -p
MySQL [(none)]> create database wp;

#create wordpress container 
docker run -ti --name wp -p 80:80 -v /var/www/html:/var/www/html/ ubuntu /bin/bash

#configure wordpress in container
$ apt update
$ apt install apache2 php libapache2-mod-php php-mysql php-common unzip wget
$ cd /var/www/html
$ wget https://wordpress.org/latest.zip
$ unzip latest.zip
$ cp wp-config-sample.php wp-config.php

# replace the database configuration inside wp-config.php
define( 'DB_NAME', 'wp' );

/** Database username */
define( 'DB_USER', 'root' );

/** Database password */
define( 'DB_PASSWORD', 'password' );

/** Database hostname */
define( 'DB_HOST', '172.23.112.79:33060' );

#start apache service 
service apache2 start

last, configure your wordpress site http://172.23.112.79/wordpress
Note: 172.23.112.79 -> is host ip