<p>I want to install MySQL in an Ubuntu docker container but I cant find clear instructions in the internet on how to do that...</p>

jkeeraa
<p>just to clarify,
install via Docker file means build and image based on ubuntu plus packages you need in it. Like myssql.</p>
<p>meanwhile container is a running instance of any docker image (which can be started and stopped like any pc).</p>
<p>so in you case it looks like you want to build an image with mysql in it.</p>
<ol>
<li>since you want ubuntu:</li>
</ol>
<p><code>FROM ubuntu:18.04</code></p>
<ol start="2">
<li>since you want mysql in you need one more line in Dockerfile:</li>
</ol>
<p><code>RUN apt-get update -qq &amp;&amp; apt-get install -y mysql-server</code></p>
<p>you can also install what every else you need in your docker image, like cron, or python.</p>
<p>just add new lines with <code>RUN apt-get install -y ....</code></p>
<ol start="3">
<li>then <code>docker build -t &quot;desired-imag-name&quot;</code> to build an image in folder where Dockerfiel is.</li>
</ol>
<p>to run it you need some blocker process to keep you container running:</p>
<ol start="4">
<li><code>docker run -d desired-imag-name bash -c &quot;sleep infinity&quot;</code></li>
</ol>
<p>that would work for testing purposes, but you need something more complicated for production - instead of <code>bash -c &quot;sleep infinity&quot;</code> some sh script which would stop mysql properly before terminating container.</p>
