We present the appearance of nearly flat band states with nonzero Chern numbers in a twodimensional "diamond-octagon" lattice model comprising two kinds of elementary plaquette geometries, diamond and octagon, respectively. We show that the origin of such nontrivial topological nearly flat bands can be described by a short-ranged tight-binding Hamiltonian. By considering an additional diagonal hopping parameter in the diamond plaquettes along with an externally finetuned magnetic flux, it leads to the emergence of such nearly flat band states with nonzero Chern numbers for our simple lattice model. Such topologically nontrivial nearly flat bands can be very useful to realize the fractional topological phenomena in lattice models when the interaction is taken into consideration. In addition, we also show that perfect band flattening for certain energy bands, leading to compact localized states can be accomplished by fine-tuning the parameters of the Hamiltonian of the system. We compute the density of states and the wavefunction amplitude distribution at different lattice sites to corroborate the formation of such perfectly flat band states in the energy spectrum. Considering the structural homology between a diamond-octagon lattice and a kagome lattice, we strongly believe that one can experimentally realize a diamond-octagon lattice using ultracold quantum gases in an optical lattice setting. A possible application of our lattice model could be to design a photonic lattice using single-mode laser-induced photonic waveguides and study the corresponding photonic flat bands.