A bucket is fine… even better than a pit in the ground. To make it work, you need to cut several holes in the bucket for air to get into your compost. You also need to mix it a few times a week to expose all parts of the compost to oxygen.
I have been using a composting pit for 2 years now and it makes excellent compost. I have a hole in the ground which is 1 meter wide x 1 meter deep x 2.5 meters long. I keep it covered with tree branches and plywood. At one end there is a ledge to allow stepping down. I put grass clippings, food scraps, shredded paper, shredded branches and debris from my garden. I also add a sack of cow manure every so often. I am very proud of the quality of compost I wind up with. It has turned out to be rich in nutrients for my vegetable garden and all of the earthworms in the soil. I garden using NO chemicals. Only compost and manure.