html file: (i deleted all the codes like !doctype html, body tag an so on for sake of time and getting into main point)

item 1
item 2
item 3
item 4
item 5
item 6
item 1
item 2
item 3
item 4
item 5
item 6
item 1
item 2
item 3
item 4
item 5
item 6

flexbox file:
.container {
 display: flex;
 flex-wrap: wrap;
 flex-direction: column;
 height: 280px;
}
flex-wrap doesn't work for too many items and it overflow in smaller screens, why?
it might be too much content for flexbox to manage on element of the smaller height. if you still want to use flex-direction with column. basically, you can increase the value of height to avoid overflow issue.
css
.container {
 display: flex;
 flex-wrap: wrap;
 flex-direction: column;
 height: 280px; //increase this value
}

or as michael wells said, using flex-direction with row instead and removing height property can also fix overflow issue.
css
.container {
 display: flex;
 flex-wrap: wrap;
 flex-direction: row;
}