This is how it goes. You create a piece of code, maybe it’s a ROS Node or a ReactJS application and you pass the package over to a friend. It’s simple build the application and start to use it. Not so fast. Something’s wrong, the version of Python you were using has changed, or the Point Cloud Library has been updated. Well, the next few hours will be trying to match up your package to your friend’s system or vice versa. What if there was a way to ensure packages run the same on various different computers? A sort of container that can be passed around? There is! It’s called Docker
Let’s get started!
Assuming you are using Ubuntu. First go ahead and install Docker from Docker Hub
$ sudo apt-get remove docker docker-engine docker.io containerd runc $ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb_release $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg $ echo \ "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null $ sudo apt-get install docker-ce docker-ce-cli containerd.io $ sudo docker run hello-world
Now you’re all set. Once the hello-world container runs, Docker is installed in your system. Yes, it’s that easy. There are a couple of commands that are useful for Docker. Check out this cheat sheet for more.