First: even if you'd do this, I'm not sure how useful this would be.
Without a corresponding snapshot of the rest of the packages (and perhaps even rosdistro/rosdep
DB), you cannot really install any additional packages without running the risk of introducing ABI incompatibilities. All newer packages would be fetched from the current Rolling repositories, which would not have any older versions available. And IIRC, the snapshot repository does not serve Rolling binaries (edit: see this comment by @nuclearsandwich on ROS Discourse fi).
Having written that: you can do this by specifying the "repo digest" of an image, instead of just a tag (which is what ros:rolling
is), similar to how you'd "go back in history" in a Git repository.
As an example: a06562802dbaf8db525a63218bd1a75f1ac4dd43f82c9c7891678c307b2a2ecf
is the hash of osrf/ros:noetic-desktop
at around September last year. You can still fetch that image using:
docker pull osrf/ros@sha256:a06562802dbaf8db525a63218bd1a75f1ac4dd43f82c9c7891678c307b2a2ecf
Note: this is not the hash shown in the IMAGE ID
column when you run docker images
.
The tricky part would be finding the hash of that "older version of the ros::rolling docker image".
If you still have a machine around which has the older version -- or had, and ran a docker pull ros:rolling
updating it -- you could use docker inspect <IMAGE_ID>
to inspect it. Look for RepoDigests
(or run docker inspect <IMAGE_ID> | jq -r '.[].RepoDigests'
).
If you don't, you'd normally be out of luck I believe -- AFAIK, there is no API to get Dockerhub to list historical digests -- but apparently docker-library/repo-info keeps track of updates to Dockerhub (for official images). For ros:rolling
, you'd have to check ros/remote/rolling.md (note: not a perma-link on purpose). To get historical hashes see the commit history of that file. Here's the one for November 3, 2022 for instance. docker pull ros@sha256:52e537f081689f869e17eba032a5823026460f47629f95bc67e21a5e56c2efc9
should get you ros:rolling
as it was around that time.
My Dockerfile starts with this:
FROM ros:rolling # Would like to roll this back one version
Use the same notation in Dockerfile
s:
FROM ros@sha256:52e537f081689f869e17eba032a5823026460f47629f95bc67e21a5e56c2efc9
this would build an image based on ros:rolling
from around the 3rd of November 2022.