How do I determine whether a truck is inside its lane?
One possible approach will be to use an algorithm which detects lines (Ex. Hough lines or any deep neural net trained to detect lanes) and use some threshold range so that we can get the lane and the edges of truck, then after extracting the lines, you can easily find the distance between them.

Then you need to experiment out on few images to get the threshold distance that you are expecting the truck to maintain as the real distance and the distance calculated using images are not same 



If you want to classify using deep learning, you may need to preprocess the images and send them. As it will become very difficult to directly learn to classify 
based on image, you may need to first detect the lanes, then apply a mask and then send the masked image to your network to make the network to converge.