Docker - What and Why
- https://articulatedrobotics.xyz/tutorials/docker/docker-overview
- https://discourse.articulatedrobotics.xyz/t/discussion-docker-for-robotics-part-1-why-and-how/429
- What is Docker?
- A VM is a way to simulate a computer running inside of a computer
- Can run 2 or more operating systems, but this is resource heavy
- Docker is not a VM- it uses containers
- We keep the core part of the OS, the Kernel (common with all Linux distros), which talks to the hardware
- Everything else running on top of the Kernel (e.g. software libraries, programs, file systems etc), which differentiate operating systems, will be run in containers
- Gives us most of the benefits of VMs, and removes most of the cons
- A VM is a way to simulate a computer running inside of a computer
Images
- We can use Docker images to create containers
- Docker images are layered, which saves storage space if have similar images (e.g. sharing a layer for Ubuntu)
- We use a Dockerfile to define what’s inside an image
- A normal workflow is to take an existing image, create a Dockerfile to add custom layers, and make a new Docker image
- A normal workflow is to take an existing image, create a Dockerfile to add custom layers, and make a new Docker image
Containers
- We can run an image to create a container, similar to flashing an image to a harddrive
- We can start and stop a container, treating it like a VM
- But can also destroy and re-run the container, keeping the important data in a shared, persistent location.
- But can also destroy and re-run the container, keeping the important data in a shared, persistent location.
Why Docker for robotics?
Using Docker
- Pull ROS2 image
docker image pull ros:humble from Docker Hub
- Show images
docker image ls
- Run container
docker run -it ros:humble
- Show running container
docker container ls
Docker 101
Crafting your Dockerfile (Docker and Robotics Pt 3)
Devices in Docker - Not so simple! (Docker for Robotics #4)
Dev Containers
https://articulatedrobotics.xyz/tutorials/docker/dev-containers