TITLE: Map which is null-homotopic on compacts
QUESTION [7 upvotes]: This is the missing ingredient towards answering my previous question.
Let $M$ and $N$ be path connected locally compact, locally contractible metric spaces (you may assume that they are manifolds). It seems the "correct" condition on $N$ is absolute neighborhood retract. Let us also assume that $M$ is $\sigma$-compact, i.e. a union of a sequence of compact sets (and then we can even assume that every compact set in $M$ is contained in an element of that sequence).

Let $\varphi:M\to N$ be such that for every compact $K\subset M$ the map $\varphi|_{K}$ is null-homotopic. Does it follow that $\varphi$ is in fact null-homotopic?

The intuition says that if there is a hole in $N$ such that $\varphi$ is wrapped around it, it should be wrapped already on some compact set.
Let me also add a specific case when $\varphi$ is identity map.

If $N$ is such that the inclusion of every compact $K$ is null-homotopic (meaning $K$ is contractible within $N$), does it follow that $N$ is contractible?

REPLY [6 votes]: The extent to which the answer to your question is no is analysed by Milnor's exact sequence. You can write $M$ as the colimit of a sequence $M_n \subset M_{n+1}$ of cofibrations with $M_n$ compact (at least if $M$ is a manifold but much more generally). Then there is a "short exact sequence" of pointed sets 
$$
\{1\} \to \textstyle{\lim^1_n} [\Sigma M_n, N]_* \to [M,N]_* \to \lim_n [M_n,N]_* \to \ast
$$ 
(in the usual sense that the map of pointed sets on the right is surjective and its fibers are orbits of the action of the group $\lim^1$ which acts on the set in the middle). Brayton Gray used this sequence to construct the example that Mark Grant mentions in the comments above in this paper (since $S^3$ is simply connected there is no difference between pointed and unpointed homotopy classes).
Another reference for the Milnor exact sequence is Bousfield and Kan, Homotopy Limits, Completions and Localizations, Corollary IX.3.3.
Edit Regarding the second question: under the assumptions, $N$ has trivial homotopy groups, i.e. it is weakly contractible. Therefore, if it has the homotopy type of a cell complex (for instance if it is a manifold) then it is contractible.