The OpenAg system runs within 2 Docker containers: one for the openag_brain ROS system, and one for CouchDB.
docker-compose coordinates between the 2 containers.
See docs.docker.com for detailed Docker documentation.
See which containers are running:
The Docker install script creates and runs 2 docker containers. You should see them listed when running docker ps:
Stoping and starting the containers is done in the usual way:
docker-compose start docker-compose stop docker-compose restart
You can get logs for the containers via docker's logging command:
docker logs -f openagbraindockerrpi_brain_1
You can run bash commands within a container with
docker exec <container> <command>
docker exec openagbraindockerrpi_brain_1 rosrun openag_brain load_fixture default
OpenAg Brain is powered by ROS. Sometimes, you might want to interact with ROS in the Docker container directly. To do so, first shell into the Docker container:
docker exec -it openagbraindockerrpi_brain_1 bash
Then, activate the catkin workspace within the Docker container:
Now, you can interact with ROS. For more, see ros.
Note that Docker containers are stateless, so if your Docker container restarts, it will lose the changes you make. If you need the changes to stick, build a new Docker image (see below).
If you're contributing to openag_brain, you might want to build new Docker images. To build new Docker images from openag_brain, you'll want to install the Docker command line tools. Running the
install_docker.sh script from openag_brain_docker_rpi on your raspberry_pi will take care of installing these for you.
Once Docker is installed, building images is easy. Just:
docker build -t openag/rpi_brain .
You can provide your own tag/name in place of openag/rpi_brain. See Docker's docs on the build command for more.
Note: we've had trouble with Raspbian's Pixel desktop freezing while building Docker images. We've also had problems with Docker builds failing on Rasberry Pi 2 when no swapfile is configured. We recommend the following build setup for best results:
Docker containers are isolated from the host environment by default. For a container to communicate with USB devices, you have to give them explicit access to the device.
With docker-compose, this is done using by adding the
devices key to your service in
... services: brain: devices: - "/dev/ttyACM0:/dev/ttyACM0" ...
You may also need to add the ''privileged'' key to the service.
If running the container via
docker run, you can use the
device flag to explicitly expose host devices to the container.