Recently, the container-based virtualization has gained increasing attention and been widely used in cloud computing. In container products such as Docker, there are a number of parameters that can control container resource usages, to avoid the resource contention occurred when running too many containers concurrently. However, it is difficult to set parameter values accurately only based on experience while tuning the parameters manually is too time-consuming to be impractical. Therefore, it becomes a challenge to set appropriate resource parameter values automatically and quickly to optimize the resource usages of container. In this paper, we present an adaptive tuning framework, conTuner, to optimize the resource configuration of container online for a new application. conTuner contains two components: an optimized configuration pool that offers candidate resource configurations, as well as a configuration optimizer that gets the appropriate optimized configuration from the pool. We have deployed conTuner in a Docker cluster. The experimental results demonstrated that, for a new application, compared to the pre-set upper limit of container resource usages, the container performance is equal or better when using conTuner, and the set resource usage constraint is more accurate. Besides, conTuner can also forecast whether resource contention among multiple containers occurs before running them concurrently. The evaluation results indicate that the prediction accuracy is 87%.