Summarize this article:

Nearly any container can be converted into a great caterpillar home as long as you are able to secure the caterpillar and provide it air holes. Since caterpillars can crawl up the sides, it's important to have a cover for its home. Otherwise, it'll crawl away. If you have an aquarium or terrarium that allows air to flow through a lid made of screen netting, then you can use it instead of a jar. Check to make sure that the entire aquarium or terrarium is secure so that your caterpillar won't escape. Your caterpillar needs to breathe, so use a porous material like cheesecloth as a lid. Make sure that your cheesecloth doesn't have holes that are big enough for the caterpillar to crawl through. You can secure the cheesecloth to your jar or pot with a large rubberband. If you don't have cheesecloth, you can try using plastic wrap with plenty of holes poked in it. Don't use a metal jar lid because it can harm the caterpillar. You can use dirt from your yard or generic potting soil. If you find the caterpillar in nature, collect dirt from the area the caterpillar is living. Don't take dirt from protected land, such as natural parks. Make your caterpillar comfortable by incorporating bits of its natural habitat. Your caterpillar will appreciate having places to crawl and hide. Collect grass, twigs, and leaves from where you found the caterpillar. Do NOT put water into your caterpillar's home because it will drown. You need to change out your caterpillar's leaves daily or at least every other day because the leaves will decay. If your caterpillar is on the old leaves, put in the new leaves and wait for it to crawl onto the new leaves on its own. Once it's crawled over to the new leaves, you can remove the old ones. Caterpillars produce a lot of waste called frass, so you need to clean its home at least once a day to prevent mold or harm to your caterpillar. Use a paper towel to wipe the frass from the cage. If you want to follow your caterpillar's natural life cycle, the place it on a porch, balcony, or in a garden if you have one. Note that placing a glass jar in full sun on a warm day for even a few minutes can cook your caterpillar, so choose your outdoor location carefully. Keep your caterpillar warm. The caterpillar will hibernate during the winter, so a cold caterpillar will not be as active. If you're keeping it inside your house, consider putting it on a windowsill.
Find a large jar or flower pot. Create a breathable lid. Put a 2-3 inch layer of dirt into your jar or pot. Add grass, twigs, and leaves. Change out the leaves regularly. Clean your caterpillar's home. Place your caterpillar's home outside.