Wonder what is the proper way to use Docker

Hello!

I’m getting started with Docker and have followed the “Get started” and “Learn by example” and more.
But here I am, stuck.

What I want to do is pretty simple. I have a PHP website that I want to dockerize. But I wonder about how to do it.

  1. Should I create a new container based on a Debian container, with an apache/php5 that I would install manually, and clone my github repo, and when I’m done then publish the container onto the Docker Hub/Cloud?
  2. Should I write a script (Dockerfile) that does the same things as previously explained?

Overall, I’m concerned about config file, DB passwords, this kind of stuff. Should this be inside the image? It’s supposed to be a file whithin the source code of the website. It doesn’t feel right to put this kind of sensitive data in a container, it’s like pushing passwords onto Github.

The idea is to deploy the image in a OVH VPS, so I was also wondering here about the deployment configuration. What I have now is a VPS with apache/php5 and a folder in /var/www which is my github clone and it works well. But it was a pain in the ass to setup the apache in a way that allowed access of the website through 127.0.0.1:8080.
Is there a way for this to work out of the box by just running the container? Since it is some config of the host system I wondered if it was even possible.