The nucleus is an organelle found in eukaryotic cells. Inside its fully-enclosed nuclear membrane, it contains the majority of the cell's genetic material. This material is organized as DNA molecules, along with a variety of proteins, to form chromosomes.
The nucleus is made up of a double membrane nuclear envelope that keeps the entire organelle encased, isolating its contents from the rest of the cell, and the nucleoskeleton which supports the cell as a whole. The nucleus maintains the security of the genes and controls the functions of the entire cell by regulating gene expression. This is why the nucleus is sometimes referred to as the control center, or the "brain," of the cell.
Since large molecules cannot get inside the nucleus through the nuclear membrane, small holes called nuclear pores dot the surface area of the envelope. These pores regulate the transport of those molecules by carrier proteins embedded in the double layer of the membrane. Small molecules and ions are able to pass through the membrane freely, however.
The nucleus is the site for genetic transcription, while keeping it separated from the cytoplasm. This means gene regulation is taking place in eukaryotic cells that have a nucleus, but that this gene regulation isn't available to prokaryotes. That means the main function of the nucleus is to govern gene expression and facilitate DNA replication during the cell cycle.