TL;DR
A single Dockerfile is usually not enough to replace a whole containers orchestration made with docker-compose and is not necessarly a good choice.
docker-compose.yml
file to a Dockerfile :You can pass some informations from your docker-compose.yml
file to your Dockefile
(the command to run for instance) but that wouldn't be equivalent and you can't do that with all the docker-compose.yml
file content.
You can replace your docker-compose.yml
file with commands lines though (as docker-compose
is precisely to replace it).
BUT
Keep in mind that Dockerfiles
and docker-compose
serve two whole different purposes.
Dockerfile
are meant for image building, to define the steps to build your images.
docker-compose
is a tool to start and orchestrate containers to build your applications (you can add some informations like the build context path or the name for the images you'd need, but not the Dockerfile content itself).
So asking to "convert a docker-compose.yml file
into a Dockerfile
" isn't really relevant.
That's more about converting a docker-compose.yml
file into one (or several) command line(s) to start containers by hand.
The purpose of docker-compose
is precisely to get rid of these command lines to make things simpler (it automates it).
From the docker documentation :
It’s ok to have multiple processes, but to get the most benefit out of Docker, avoid one container being responsible for multiple aspects of your overall application
So you can if your entrypoint permits you to launch several processes, or if you use a supervisor, but maybe that's not necessarly the best idea.
EDIT
Since I'm not sure it's clear for you either, here is the difference between a container and an image.
You really should check this out and try to understand this before working with Docker since it's a very necessary thing to know.