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

#install docker
sudo apt install

#create mysql container and database
$ docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=password -p 33060:3306 mysql
$ mysql --host= --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
$ unzip
$ 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', '' );

#start apache service 
service apache2 start

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