Growing valerian in a container controls the spread of its rhizomes but you still have the issue of the seeds being easily dispersed. Make sure to remove the flowers right after they fade and before they turn into seeds, and dispose of the flowers in the trash.