Installing ROS 1 on macOS with Docker

Many native tools in the ROS ecosystem are only supported on Linux, often making robotics development on other operating systems difficult and tedious. To solve this developer friction, many roboticists have turned to container platforms like Docker to help them work cross-platform.
In this tutorial, we'll cover how you can quickly get up and running with ROS 1 on your macOS computer – all with the help of Docker containers.
Pulling a Docker image
Docker is a container platform that allows you to run an instance of an operating system on top of a host. It can empower teams to develop robots with unique operating system requirements, regardless of their own system specs, or to work with ROS distributions that are not supported on the host operating system.
A Docker image essentially packages software into standardized units for reproducible development and deployment. It's a lightweight, standalone, executable piece of software that includes everything needed to run an application – all the code, runtime, system tools, system libraries and settings.
Once you've installed Docker on your macOS machine, you can browse Docker Hub for available ROS images. Download – or "pull" – your desired image (in this case, ROS 1 Noetic) from Docker Hub:
$ docker pull osrf/ros:noetic-desktop
Verify that you've downloaded the correct image:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
osrf/ros noetic-desktop 6dc5604f72f7 5 weeks ago 2.31GB
Running the container
You can now use your downloaded images to start your ROS 1 container and to run a roscore
inside it:
$ docker run -it --network=host --name=ros1 osrf/ros:noetic-desktop bash
$ roscore
The -it
option will open an Interactive Terminal, --network=host
will open the same network to the container as the host, and the --name
is useful to reopen the container later with the command docker exec -it <name> <cmd>
.
Connect to the current container:
$ docker exec -it ros1 ./ros_entrypoint.sh bash
Publishing data in the container
In one terminal, publish a /chatter
topic:
$ rostopic pub /chatter std_msgs/String “data: hello” -r 1 # ROS 1
In another, verify that the message is being published:
$ rostopic pub /chatter
Verify that your ROS 1 container is still running:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8b572e8afbb9 osrf/ros:noetic-desktop "/ros_entrypoint.sh …" 7 minutes ago Up 7 minutes ros1
Use docker stop <name>
and docker start <name>
to stop and restart a container.
Visualizing the data in Foxglove Studio
Next, let's verify that we're publishing ROS messages in our Docker container by visualizing them in Foxglove Studio.
Let's pull the pre-built foxglove_bridge
Docker images to run a ROS container and visualize its data in Foxglove Studio:
$ docker pull ghcr.io/foxglove/noetic-ros1-bridge:latest
To be able to connect Foxglove Studio to the container, you must publish the port 8765 on the Docker server with the -p 8765:8765
option.
Start the foxglove_bridge
inside the container:
$ docker run --name=foxglove_ros1 -it -p 8765:8765 ghcr.io/foxglove/noetic-ros1-bridge /./ros_entrypoint.sh bash -c "roslaunch foxglove_bridge foxglove_bridge.launch"
To test the connection, open a new Terminal window and connect to the current container. Then, publish a simple string message:
$ docker exec -it foxglove_ros1 /./ros_entrypoint.sh bash
$ rostopic pub /chatter std_msgs/String "hello!"
Now, open your Foxglove Studio desktop app, initiate a Foxglove WebSocket connection with the default URL, add a Raw Messages panel listening to the /chatter
topic, and verify that it shows the string message "hello!":
You've now successfully run ROS 1 in a Docker container, and connected it to Foxglove Studio to visualize that data.
Stay tuned
With Docker containers, you can seamlessly continue development across different platforms – regardless of your robotics framework's constraints.
Reach out to us directly in our Slack community to ask questions or request a topic for the next tutorial. And stay tuned for a tutorial on installing ROS 2 on macOS with Docker.
Read more:
Visualize simulated sensor data with Foxglove Studio.

Use Foxglove Data Platform to import and export MCAP files with metadata records and attachments.

Get blog posts sent directly to your inbox.