Theme
Tier 4 · lesson 5 of 10 · 35 min

An image that carries no simulator

You will: Build the image that would go on a robot, and verify what it does not contain.

Builds on Docker, and nothing else.

The development image is about 6 GB of ROS, Gazebo, a CAD kernel, RViz and a virtual display. None of that belongs on a robot.

So the Dockerfile has seven stages, and the robot's image is built from an early one:

base      ROS 2 and ros2_control. No simulator, no GUI.
  ├── simdeps   + Gazebo
  │     ├── ci      + test tools              what CI runs
  │     │     └── cad   + geometry kernel
  │     │           └── dev  + RViz, noVNC   what you run    6.13 GB
  │     └── builder + the robot packages, built
  └── runtime   base + that build             what ships      1.68 GB

About a quarter of the size. It was a third before the CAD stage was added under the dev image — and the robot image did not grow at all, because nothing on the robot needs a geometry kernel. That separation is only possible because the packages that run on the robot genuinely do not depend on Gazebo. That is the boundary test from Stage 1, paying out as a build artefact.

make runtime-verify then checks the claim rather than trusting it: no simulator packages, no copyleft tooling from the dev stage, the simulation package not installed, a git commit baked in — and then it starts the stack, because an image that is clean and cannot run has only solved the easy half.

Three details, each of which cost time:

  • "No simulator" is the honest claim; "no Gazebo code" would not be. One robot dependency pulls about 8 MB of Gazebo libraries and the generic gz tool. gz sim is absent; the claim is worded to match.
  • The runtime user needs a writable home. ros2 launch creates a log directory before anything else, and without a home it dies in a traceback that never mentions permissions.
  • Health checks use 127.0.0.1, never localhost. Inside a container localhost can resolve to the IPv6 address first, and a server bound to IPv4 only then fails a perfectly healthy check.

No platform is pinned, either. The base image is published natively for both architectures, so it builds natively on an Apple Silicon Mac and on an x86 runner. Pinning one would force emulation on the other.

In the simulation

No image is built here, and the robot's image carries no simulator, so a page like this one is development-side by definition. What it can show is the half of make runtime-verify that matters most: a stack that starts publishes joint states and a transform, and moves when asked.

Kinematic: joints move at their real speed limit, but there is no gravity, no load and no physics. That is what the steps below are for.

The SO-101 loads as you reach it.

In this lesson

  1. Open the /joint_states view. The runtime image must publish these same six joints.
  2. Press ready. A stack that is clean but cannot do this has solved only the easy half.
  3. Open the tf view: the transform robot_state_publisher would publish from the runtime image, with no Gazebo anywhere in it.

Do it

  1. Build the robot image.

    make runtime
    

    Expect: The image name and its size — about 1.7 GB, a quarter of the dev image.

  2. Verify it.

    make runtime-verify
    

    Expect: ok lines for every absent package, the commit, and a stack that starts with controllers active.

  3. Compare the two images.

    docker images | grep threevn-robotics
    
  4. Read what the image says about itself, without running it.

    docker inspect --format '{{index .Config.Labels "org.opencontainers.image.revision"}}' threevn-robotics-runtime:local
    

    Expect: The full commit hash it was built from.

You will know it worked when: The runtime image starts the control stack, contains no simulator, and can tell you which commit it is.

When it goes wrong

The robot image dies at launch inside get_logger(), with no mention of permissions.

Why: The runtime user has no writable home, and ros2 launch writes logs under it before anything else.

Fix: Create the home directory, and set ROS_LOG_DIR explicitly so the location is predictable.

A health check fails against a service you can reach by hand.

Why: localhost resolved to ::1 first, and the server listens on IPv4 only.

Fix: Use 127.0.0.1 in health checks.

Terms

Multi-stage build
One Dockerfile producing several images from shared stages, so the shipped image can stop before the heavy development layers.
OCI labels
Standard metadata baked into an image — its source, revision and build time — readable with docker inspect without running it.

Every term in the course: glossary.

Check yourself

Answer in your head first, then open it.

Why does the robot image's size depend on a test written in Stage 1?

The runtime image can skip Gazebo only because the robot's packages do not depend on it — and the dependency test is what keeps that true.

Why does runtime-verify start the stack instead of only inspecting packages?

Small and clean but unable to run is worse than large and working. Absence of the wrong things is half the claim; the other half is presence of a working robot.

Stretch

Run docker history threevn-robotics-runtime:local and find the largest layer. Does a robot need what is in it? If not, what would it take to remove it — and what would you have to re-verify?

Going deeper