-
Notifications
You must be signed in to change notification settings - Fork 9
Docker
The docker image is a way to build our code on a clean platform, and then run it on the tractor. This allows you to write your code and test it in an easy manner. We also use docker to maintain integrity of our master branch - any pull request that fails to successfully build will be automatically rejected.
To get started with Docker, follow the instructions below (based on this page) (Note: This is written here for convenience for newer team users, assuming a relatively clean setup. If docker has been installed before/you want to do more fancy things with it, read the full docs)
- Update the
apt
package index and install packages to allowapt
to use a repository over HTTPS:
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
- Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017-02-22 [S]
- Set up the stable repository (instructions simplified - for full details see the link)
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
- Update the
apt
package index, and install the latest version of Docker Engine
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
- Verify that Docker Engine is installed correctly by running the hello-world image.
$ sudo docker run hello-world
To use Docker to test your build locally, first navigate to where you have the gravl package saved, then run docker. Docker will then use the Dockerfile
to know how to set up the docker container.
$ cd ~/catkin_ws/src/gravl
$ sudo docker build .
If all goes well, the last line of the build should say Done. Your build exited with 0.
- Build the image
docker build -t gravl <your_gravl_project
>. -Ssave the image in a transportable format:docker save gravl -o gravl.tar
- Transfer this file to the tractor e.g, with SCP:
scp gravl.tar kubo@192.168.1.3
- From the NUC, run
docker load -i <that file location>
. - From the NUC, run
docker run --privileged -it --rm gravl
- Test your code in the presented console.