Look at the withdraw and transfer sections in the API documentation.
http://docs.screeps.com/api/#Creep.withdraw http://docs.screeps.com/api/#Creep.transfer
I have a creep that will withdraw from a container and transfer it to different structures that need it. (hauler) I have another creep that sits on top of a container and harvests from the resources in the room. (miner)