So the option of docker run and not docker. You forgot to mention that before. But the way to learn about it is the same. Checking the help
docker run --help
-h, --hostname string Container host name
I never use it, but it indeed affects DNS resolution because you can use that to acess the container on a user-defined network in addition to the container name an container id (or in compose, the service name).
The following command (use the actual container name) can show you what can be used fo dns resolution:
docker container inspect CONTAINRNAME
Somewhere at the end of my output:
"DNSNames": [
"test-name",
"a7f7b7383945",
"test-host"
]
That has nothing to do with the resolv conf file so to this topic, but I wrote about it: LINK
If you want to learn more about it, please, open another topic, but you could also find other existing topics in which we discussed it.
I don’t think that you need any advanced customization. I almost never do that either, but (if you wanted to refer to that too) docker network create
is a very standard and very normal and frequent thing to do. It is just part of using Docker. But if you use Docker Compose, you don’t have to worry about that either.
Again, that is not related to the resolver so you could open a new topic, but A Dockerfile and a compose file is for completely different purposes. You can find tutorials about those too on the sitefrom which I linked the EXPOSE tutorial. Note that there is no network configuration in a Dockerfile. It is not for that, but for creating your base filesystem with some metadata used when the container starts.
Whether it has an advantage or not, depemds on your use case, but if you need an nginx in front of your app, then a separate container is the right way in most of the cases and trying to add both apps in a single container adds a different kind of complexity and not recommended. It could be discussed in another topic as well, but you could also search for something like “why not docker multiple app in a single container” on Google.