On "Concised Course of Algebraic Topology", a fibration is defined to be surjective. And there is a proposition:
If $i:A\to X$ is a cofibration and $B$ is a space, then the induced map $p=B^i:B^X\to B^A$ is a fibration.
I know in category of compactly closed spaces, a cofibration is injective with closed image. But I want to know this implies $p=B^i$ is surjective.
Since no one has yet answered your question, I'll type up what is basically the answer Noel Lundström left in the comments, and try to add a little of my own knowledge for context.
Firstly it should be pointed out that fibrations need not be surjective in general. Indeed, in his follow up book, More Concise Algebraic Topology, May writes;
Hopefully this should go some way to correcting your disatisfaction. In particular, when $B$ is path connected, then any fibration $p:E\rightarrow B$ is surjective.
For some examples of where a fibration might be non-surjective we have the following.
$\bullet$ For any space $X$, the unique map $\emptyset\rightarrow X$ is an unpointed (Hurewicz) fibration. Clearly this map is very rarely surjective.
$\bullet$ Michael Albanese's suggestion here of adding additional path components to $B$ without altering $E$.
$\bullet$ Noel Lundström's suggestion from the comments: the inclusion $i:S^1\hookrightarrow D^2$ is a closed cofibration and so the induced map $i^*:(S^1)^{D^2}\rightarrow (S^1)^{S^1}$ has the homotopy lifting property for formal reasons. A point $f\in (S^1)^{S^1}$ is a map $\ast\rightarrow (S^1)^{S^1}$ (working in the unpointed context), and by adjunction this is the same as a map $\widehat f:S^1\rightarrow S^1$. Then the $f$ is in the image of $i^*$ if and only if $\widehat f$ admits an extension to $D^2$. But the only time that this can happen is when $\widehat f$ is null-homotopic, and clearly not every map $S^1\rightarrow S^1$ is null-homotopic. Hence $i^*$ cannot be surjective.