Master Nyojo was a demanding and rigourous person. One day, during the course of a sesshin, Dogen had a great shock. While seated in zazen his neighbour fell asleep on his zafu. Nyojo exclaimed in a loud voice: "Shin jin datsu raku (reject body and mind)!" and hit the monk hard with his sandal, causing him to fall from his seat. On hearing these words Dogen had an internal revolution. After zazen Dogen went to the room of his master and said to him: "Shin jin datsu raku, I have abandoned body and mind". Nyojo answered him with: "Datsu raku shin jin, abandon again body and mind".
Dogen remained another two years close to Nyojo, until he decided to return to Japan. His master confirmed that it was time for him to teach on his return " the teaching of buddhism helping others to awaken to the universal truth". In 1227 Dogen returned to Japan, taking only with him zazen, shikantaza, just as his master had shown him. On his return to Japan, they asked him: "What did you discover?" Dogen replied: "I came back with empty hands". In his book Eihei Koroku, he wrote later: "Having studied only with my master Nyojo and plainly understanding that the eyes are horizontal and the nose vertical, I return home with empty hands... Starting tomorrow, in the morning, the sun will rise in the East; disturbed by night, the moon goes down in the West. The clouds disappear and the mountains manifest their reality, rain shall stop falling and the Four Mountains (birth, old age, sickness and death) will become level."
Dogen first based himself at Kennin-ji, the temple of Myozen, his first master with whom he had gone to China and who died during the journey. It was in this temple that he wrote his first collection: Fukanzazengi, universal rules for the practice of zazen. It is the core of his teaching: just sitting down in an exact posture without seeking anything, letting thoughts pass like clouds in the sky.
Later Dogen left the temple at Kennin-ji to establish himself in three temples successively, all situated in the region of Kyoto: Annyoin, a small hermitage in 1230, later Kannon Dorin in 1233 and finally Kosho-ji where, with the help of donations, he constructed the first truly independent zen monastery of Japan in 1236. In Kosho-ji he started editing the first chapters of his monumental work: Shobogenzo, "The Treasure of the Eye of the True Law", ninety five chapters containing the essence of his philosophical and religious vision.
Between 1233 and 1243 many disciples gathered around him and followed his teaching, particularly Ejo (in 1234) who would become his succesor. His fame continued to grow. He drove people on to practice assiduously, just as he had been taught by his master Nyojo in China. Dogen's success, this breath of fresh air he brought to a calcified buddhism attracted hostility from the clerical hierarchy. So much so that in 1243, monks from Mount Hiei tried to burn down his temple at Kosho-ji. As a result, Dogen decided to leave behind the agitation of the cities and the confusion they can create in the spirit. Thanks to the support of a lay disciple, lord of the province of Echizen in the north east of the country, (nowadays the prefecture of Fukui), on the coast, he constructed a new temple, which he baptised, "temple of eternal peace", Eihei-ji, where Ejo would later become abbott, after his death.
There, in the calm of the vast mountain, he continued to teach zen to his disciples and continued work on the Shobogenzo. Far away from the world, he only left this place once, during the winter of 1247-1248 to visit the shogun in Kamakura, at the invitation of general Hojo Tokiyori. Tokiyori was fascinated by Dogen and wanted him to stay close by. He would build Dogen a great monastery. Dogen rejected his proposal, preferring solitude. He continued practicing zazen until 1252, at the age of just fifty two years, he fell gravely ill. He went to Kyoto to receive care, without succes. He passed away on the 28th. of august 1253 in the temple of Takatsuji.