Background: I want to run my own MediaWiki (Wikipedia) on my internal network, with Docker. After hours of trial-and-error, the below script is what appears to work; I just don’t know whether it’s “safe” and secure.
docker run --name MediaWiki_mysql \ #It is encouraged to install mysql onto a different container from the main MediaWiki container, hence the creation of this container
-v V_MediaWiki_mysql:/var/lib/mysql \ #this creates a volume from the mysql data; if this is not inputed, mysql would create a random-named volume
-e MYSQL_DATABASE=wikidb \
-e MYSQL_USER=*** \
-e MYSQL_PASSWORD=*** \
-e MYSQL_ROOT_PASSWORD=*** \
-e MEDIAWIKI_DB_PORT=3306 \
-d mysql:8.0.35 #my chosen version of mysql; the “latest” was using an older version of mysql
docker run --name MediaWiki \ #this creates the actual MediaWiki container
-v V_MediaWiki_Data:/var/lib/mysql \ #this stores all of the MediaWiki images, webpages, and settings in a volume INSTEAD OF the container
-p 8080:80 \ #specifies the webpage port (8080)
–link MediaWiki_mysql \ #links this mediawiki container to the specified mysql container
-d mediawiki #uses the latest Mediawiki container
#Afterward, within the MediaWiki container, I ran apt-get update && apt-get upgrade. Afterward apt-get install nano , I used Nano to write the “LocalSettings.php” data onto var /lib/mysql.
What I’m primarily worried about us specifying the “MEDIAWIKI_DB_PORT=3306”. Any and all feedback welcome.