I'm working on a Windows laptop and running Docker for Windows on it. I want to run an Ubuntu container with a specific version and a MySQL server on it. So the question is, do I have to download MySQL on the Ubuntu container or can I run 2 containers (Ubuntu and MySQL) and combine them? How do I combine these 2 containers?
At first, I misread your question, thinking you wanted to run more than one service together, so I had recommended Docker Compose which makes it easy to run multiple services together, with networking, and can even specify the start up order.
But now I see you are just trying to run MySQL, and wondering do you need separate containers for the OS and MySQL: in short, no you don't need two containers. Instead, just get the MySQL image from DockerHub at https://hub.docker.com/_/mysql?tab=description
The reason you can just use that MySQL Docker image by itself is because it already is installed on a Debian image, which you can see in the Dockerfile at https://github.com/docker-library/mysql/blob/master/8.0/Dockerfile where it shows:
So, to solve the problem, do:
docker pull mysql
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tagas mentioned in the instructions on the Docker Hub page. Additional documentation at https://github.com/docker-library/docs/tree/master/mysql
I do strongly recommend using Docker Compose (
docker-compose command) to run containers, as it makes it easier to organise and run them.