Is it true that in the ideology of communism, the government owns all the companies and the exploitable resources ? , and what about the socialist countries and socialism as an ideology and are there any examples of this occurring?
Depends of what kind of socialism you area talking about. The answer above describes communism and how nationalizing the economy is not part of the final stage of communism. However, Karl Marx believed that one method for true communism is socialism or the lower stage of communism to achieve the final stage of communism. In his work Critique of the Gotha Program, Karl Marx mentions the dictatorship of the proletariat, a form of the state where members of the working class take control of the state and nationalize the means of production in order to make everything publicly owned and improve the standing of the current community.
Between capitalist and communist society there lies the period of the revolutionary transformation of the one into the other. Corresponding to this is also a political transition period in which the state can be nothing but the revolutionary dictatorship of the proletariat. -Karl Marx
This lower stage of communism is what we saw in the USSR and Maoist China. This is also what people mean when these nations are referred to as 'communist'. They were experiments to achieve this lower stage of communism where a council of members of the proletariat and potentially a leader of the council take the means of production to achieve collective ownership using the state, a cooperative with control of all utilities, or some other organization. Personal property is given to members of the proletariat based on the principle of "each according to his contribution" (which in many socialist countries, meant the members of the state get the most personal property), but public property is only utilized by those who are part of the worker's council. People like Marx and Vladimir Lenin grew to believe that this form of communism would be the only form that would be able to uplift the people to a higher stage of production while opposing capitalist countries that would seek to stop the revolution
"The dictatorship of a single class is necessary not only for every class society in general, not only for the proletariat which has overthrown the bourgeoisie, but also for the entire historical period which separates capitalism from "classless society", from communism. Bourgeois states are most varied in form, but their essence is the same: all these states, whatever their form, in the final analysis are inevitably the dictatorship of the bourgeoisie. The transition from capitalism to communism is certainly bound to yield a tremendous abundance and variety of political forms, but the essence will inevitably be the same: the dictatorship of the proletariat. -Vladimir Lenin, The State and Revolution
However, eventually, Karl Marx believed this dictatorship would naturally erode away because, to compete with capitalism, the dictatorship of the proletariat would have to provide education, technological development, and standards of healthcare. Then, once the people and society became advanced enough, the state would erode away through a final revolution or natural human development, leading to the last stage of communism and a clean, stateless society. So, to answer the question, all countries are nationalized if you are achieving lower-stage communism using the methods outline by Karl Marx in Critique of the Gotha Program. For the final stage of communism, however, the state should be eliminated by this point and while might be a small government or council that still manages certain resources, there is no state left or nationalization.
Naturally this depends on what is and what isn't a "communist" or "socialist" country. There are some countries that claim this mantle, and yet are (by some definitions) neither communist nor socialist.
In the concept of communism implied by Marx in the Communist Manifesto and Das Capital, communism is about the common ownership of the means of production. The notion of a "company" with "owners" who are separate from the "workers" is dissolved. The means of production are held in common by those who work and there isn't a class of people who benefit from ownership without doing work.
Likewise the government is a common enterprise of the people. There isn't a political class of leaders who rule over the workers, and indeed the notion of the state as it exists in the pre-communist society is radically different. The idea of a political class forcing the working class to go to war against the working class of a different nation is inconceivable in the communist society. So the notion of "government" is radically different.
It is certainly not the case that in the communism as described by Marx that a political class called the "government" would "own" things called "companies", for those three things (government, ownership and companies) would not exist in the form that they do today.
Naturally, all this is utopian, and no country claiming to be communist has implemented this. In the Soviet Union and China, for example, the government did own all the large scale companies, sometimes in complex ways, though smaller private enterprise did exist, it was often part of a grey economy. In modern China things are different again, and the system created largely by Deng Xiaoping can't be seen a Marxist system, but something else. The government (at various levels) is intimately connected to industry it controls, but not necessarily purely through ownership.