The housing for mounting an elongate-shaped container on an injection pen comprises an elongate-shaped body which extends along a longitudinal axis (X30) and which defines an interior volume (V32) for fully receiving the container. The body is provided, on the outside of a first axial end, with at least one first mechanical member for attaching a needle. The body is further provided, in the vicinity of a second axial end opposite the first axial end, with at least one second mechanical member for attaching the housing onto an injection pen. The housing further comprises, in the vicinity of the first axial end thereof, at least one third mechanical member for irreversibly locking a container in position, fully contained in the interior volume (V32) of the body of the housing. Said third locking member is formed by an elastically deformable tab intended to ensure locking of the container in position in the interior volume (V32) of the body of the housing, by axially retaining a flange of the container.