Docker install on ubuntu server

assuming docker and atleast nano is installed
nano xwiki.sh add the folowing

#!/usr/bin/env bash

head /dev/urandom | tr -dc A-Za-z0-9 | head -c10 >> ~/pass.txt
mkdir -p /opt//xwikimariadb
mkdir -p /opt/xwiki/xwiki
mkdir -p /var/lib/xwiki

docker run -d \
   --name xwiki-mariadb \
   -v /opt/xwiki/mariadb:/var/lib/mysql \
   -p 127.0.0.1:3309:3306 \
   --restart always \
   -e MARIADB_DATABASE=xwiki \
   -e MARIADB_ROOT_PASSWORD=$(cat ~/pass.txt) \
   mariadb

docker run -d \
--name xwiki \
-p 127.0.0.1:8084:8080 \
-v /opt/xwiki/xwiki:/var/lib/xwiki \
-e DB_USER=root \
-e DB_PASSWORD=$(cat ~/pass.txt) \
-e DB_DATABASE=xwiki \
-e DB_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' `docker ps -aqf "name=xwiki-mariadb"`) \
xwiki:lts-mysql-tomcat

save and run

chmod +x xwiki.sh && ./xwiki.sh