How to do custom docker image that has certain features disabled

I think I have what I need now. I waited for the optimization to finish in the container (5 1/2 minutes) and then used docker commit to create a new image. When I restarted everything in my docker-compose file, Kibana started up and was ready as soon as Elasticsearch was.