<p>At first, I misread your question, thinking you wanted to run more than one service together, so I had recommended <a href="https://docs.docker.com/compose" rel="nofollow noreferrer">Docker Compose</a> which makes it easy to run multiple services together, with networking, and can even specify the start up order.</p>
<p>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 <a href="https://hub.docker.com/_/mysql?tab=description" rel="nofollow noreferrer">https://hub.docker.com/_/mysql?tab=description</a></p>
<p>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 <a href="https://github.com/docker-library/mysql/blob/master/8.0/Dockerfile" rel="nofollow noreferrer">https://github.com/docker-library/mysql/blob/master/8.0/Dockerfile</a> where it shows:</p>
<pre><code>FROM debian:buster-slim
</code></pre>
<p>So, to solve the problem, do:</p>
<ol>
<li><code>docker pull mysql</code></li>
<li><code>docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag</code> as mentioned in the instructions on the Docker Hub page. Additional documentation at <a href="https://github.com/docker-library/docs/tree/master/mysql" rel="nofollow noreferrer">https://github.com/docker-library/docs/tree/master/mysql</a></li>
</ol>
<p>I do strongly recommend using Docker Compose (<code>docker-compose</code> command) to run containers, as it makes it easier to organise and run them.</p>

CC BY-SA 4.0
2020-08-20T07:18:55.480Z
Thanks Mike this is really helpful. Actually you answered 2 things for me . So when i want a Debian container with mysql apache freeradius etc in it( with network config and so on) i do it with docker compose right?
user19215
CC BY-SA 4.0
2020-08-20T14:42:24.833Z
@user19215 docker-compose is not required, but just a helpful way to run containers. You could instead do the same using docker commands, but docker-compose is much easier to configure (the `docker-compose.yml` is YAML syntax).
mikequentel
CC BY-SA 4.0
2020-08-21T02:24:37.843Z
@user19215 So if you want multiple services in one container not in different ones that are connected via a network then you will have to create your own Docker image. This is pretty simple to do if you just want basic non production ready images.
joshk132
CC BY-SA 4.0
2020-08-26T12:11:03.080Z
@user19215 Here's official documentation on running multiple services in a single container: https://docs.docker.com/config/containers/multi-service_container/
Konrad Botor
CC BY-SA 4.0
2020-08-26T12:13:28.390Z
@user19215 That being said it's not recommended as Docker containers are meant to be application containers, that is there should be a single service running in a single container. It sounds like what you want are OS containers like LXC: https://linuxcontainers.org/
Konrad Botor
CC BY-SA 4.0
2020-08-19T13:34:51.560Z
2020-08-20T03:18:02.023Z
2020-08-20T03:18:02.023Z
mikequentel
<p>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?</p>

<docker><windows><mysql><ubuntu>
Combining Two Containers
user19215
# Combining Two Containers

(Asked by: username_0 on 2020-08-19)

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?

**Tags:** docker, windows, mysql, ubuntu


---

## 1 answers

### Answer by username_1 on 2020-08-19. Score: 2

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:
FROM debian:buster-slim

So, to solve the problem, do:

docker pull mysql
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag as 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.

> **Comments:**
> **username_0**: Thanks Mike this is really helpful. Actually you answered 2 things for me . So when i want a Debian container with mysql apache freeradius etc in it( with network config and so on) i do it with docker compose right?  
> **username_1**: @username_0 docker-compose is not required, but just a helpful way to run containers. You could instead do the same using docker commands, but docker-compose is much easier to configure (the `docker-compose.yml` is YAML syntax).  
> **username_2**: @username_0 So if you want multiple services in one container not in different ones that are connected via a network then you will have to create your own Docker image. This is pretty simple to do if you just want basic non production ready images.  
> **username_3**: @username_0 Here's official documentation on running multiple services in a single container: https://docs.docker.com/config/containers/multi-service_container/  
> **username_3**: @username_0 That being said it's not recommended as Docker containers are meant to be application containers, that is there should be a single service running in a single container. It sounds like what you want are OS containers like LXC: https://linuxcontainers.org/  

---

