In Docker, if the layers are cached, the layer with apt-get won't be automatically invalidated (unless --no-cache or any changes to the upper layers).
When said caching, I meant on the nodes that run the containers. With Nix you can also update only one layer, while keeping the other layers the same.