Well jetways don't exactly 'dock' with an aircraft; there is no hard coupling between the tunnel and the airplane like say that found with a spacecraft docking. Rather they are just maneuvered up against them with a soft canvas hood which can be actuated around the fuselage allowing protection from the weather for passengers and crew.
The jetway is maneuvered to and away from an aircraft via a small control panel near the hood of the jetway which controls an electrically driven wheeled drive supporting the terminus end of the jetway as well as screw jacks in the support pillars for elevation control. This allows a user to translate the length of the tunnel or rotate it about its connecting point to the terminal. The tunnel can do this by means of telescoping sections. The terminus of the jetway can be swiveled to match the curvature of the fuselage and the tunnel makes contact with the jet at the base of the terminus, usually with a neoprene bumper to prevent damaging the fuselage. The hood can then be lowered for weather protection.
The jetway will reverse this process after the main cabin door has been closed and secured and before pushback to prevent contact and damage with the aircraft during pushback.