When a man of war vessel entered a foreign port, the crew would man the rails (stand on deck at the rail) as evidence that there was no hostile intent (if they were all on deck, they couldn't be preparing the guns to fire). In this respect it's linked to the tradition of Gun Salutes, by which you fired your cannon at sea before entering port as proof they were empty.