I use Docker a lot at work (everything we do runs on AWS or Google servers), and that makes separating things relatively simple.
AWS has different environment variables for different configurations, allowing one Docker image to run with different settings. With docker-compose you can tie together tailored Dockerfiles and different images for different purposes, as needed. I recommend having a default "docker-compose.yml" be the dev environment, with its own environment variables, and variants for staging/prod with other names expecting envvars from the system it's running on. This makes the default invocations of docker-compose launch in local dev mode.
We use a lot of Python (Django, Wagtail) which expects envvars anyway, so it's a natural way to do things there. For Go I either write AWS-specific things which only expect envvars, or use a configuration system which overrides config files with outside vars.
We haven't started using Kubernetes yet, but the process probably won't be much different.