Need to do a slow 10 minute warmup with a light load on your legs and be sure that the seat height allows for 90% extension of the leg. Usually sore knees are the result of shoe cleat alignment or a seat that is the wrong height. With a new bike I set the seat so it is a bit too high and then after a full warmup and giving my muscles and ligaments time to warm up and stretch I will start gradually lowering the seat until I can ride while keeping my hip bones level.
Ice is magical in reducing swelling and hastening recovery by allowing the body to clear waste products from exercise. 20 minutes is a good time for the ice bags on the knee(s).