-
Notifications
You must be signed in to change notification settings - Fork 1
Docker
Docker is a way of creating containers that act kind of like virtual machines. They are useful because you can create one configuration and run it on any machine. The GitLab servers run tests in a container that generally identical to the one that is run on the actual robot and the same containers can also be used to develop in.
The configuration is stored in a file named Dockerfile and is more or less just an install script. The most important thing to note that it is built on top of a docker image with ROS already installed. That shortens the dockerfile significantly.
There are a lot of parameters that can be used to start a docker container, especially when multiple containers are running. We use docker compose to manage this. All the parameters are stored in docker-compose.yml. This handles stuff like which ports are passed through and what USB ports the container will have access to. Starting everything is as simple as running docker-compose up.
- Start everything:
sudo docker-compose up- Rebuild and start everything:
sudo docker-compose up --build
- Rebuild and start everything:
- Stop everything:
sudo docker-compose down - Updating the GitLab docker image
- Get a list of containers/services and their status:
sudo docker-compose ps - Get a terminal in a running container (replace bash with sh if this doesn't work):
sudo docker-compose exec [service name] bash- The service name (e.g. ros-master) is defined in docker-compose.yml and is different than the container names listed by
docker-compose ps. - Replace
bashwithshif this doesn't work - Or replace
bashwith any command to run in that container
- The service name (e.g. ros-master) is defined in docker-compose.yml and is different than the container names listed by
- Start a new container and get a terminal into it:
sudo docker-compose run [service name] bash
The docker container registry image should be updated when changes are made to the dockerfile.
docker login gitlab.cs.wallawalla.edu:5050docker build -t gitlab.cs.wallawalla.edu:5050/robotics-club/rover .docker push gitlab.cs.wallawalla.edu:5050/robotics-club/rover
# create the docker image
sudo docker image build -t rover:1.0 .
# create the docker container
sudo docker container create --name dockertest rover:1.0
# start the container
sudo docker run -it --name dockertest rover:1.0
# list running containers
sudo docker ps
# get interactive bash terminal
sudo docker exec –it dockertest /bin/bash
# or
sudo docker attach dockertest
# kill the docker container
sudo docker container rm --force dockertest