Difference between revisions of "Docker"

From PaparazziUAV
Jump to navigation Jump to search
m
(add more info on howto use Docker)
Line 1: Line 1:
There is [https://www.docker.com/ Docker] support available to easily build/test Paparazzi within a container.
Docker is an open platform used to build, ship, and run distributed applications. You can learn more about Docker by visiting its website, https://docker.com.


In particular, if you're just getting started using Docker with Paparazzi, we encourage you to make use of the following resources:
* [https://www.docker.com/whatisdocker/ What is Docker] - A page that will give you excelent high level overview of Docker and its purpose.
* [https://docs.docker.com/ Documentation] - Browse the online documentation and references to find information about Docker's various functions and tools.
* [https://forums.docker.com/ Forums] - If you need help, just ask! Docker has a great user community, with lots of people willing to help answer any questions you might have.
* [https://groups.google.com/forum/#!forum/docker-userl Mailing list] - Another way to start a discussion and follow community activities.
For new users of Docker, those resources will provide you with most of the information you'll need to get familiar with the platform. Additional information pertaining to using Docker for Paparazzi can be found on this page.
You can test out Docker right now using a live online tutorial, try it out yourself: [http://docs.docker.com/linux/started/ Linux] / [http://docs.docker.com/mac/started/ Mac].
We have some images and scripts to easily build/test Paparazzi within a container.
== Pulling Paparazzi images ==
There are prebuilt images containing all the Paparazzi dependencies on [https://hub.docker.com/u/flixr/ Docker hub], which you can just pull:
<source lang="bash">
docker pull flixr/pprz-dep
docker pull flixr/pprz-dev
</source>
Or in your local clone of the Paparazzi repository:
<source lang="bash">
<source lang="bash">
cd docker
cd docker
make pull
make pull
</source>
The pprz-dep image contains all dependencies, the pprz-dev image adds some convenience stuff and a pprz user. Normally you will want to use the pprz-dev image.
== Building and Running Paparazzi inside Docker ==
You can simply start a shell inside the pprz-dev container
<source lang="bash">
docker run -it flixr/pprz-dev bash
</source>
You could now clone the paparazzi repo inside this container and build it.
However this does not give you access to the X-Server, USB, etc..
To make Docker more useful to us and enable using and editing Paparazzi files from the host system, the repo contains a [https://github.com/paparazzi/paparazzi/blob/master/docker/run.sh helper script]. See also https://github.com/paparazzi/paparazzi/pull/1272
Starting a shell (or [[Paparazzi Center]] directly) through this script will enable access to the X-Server, USB devices and audio and set mount your current Paparazzi directory in the home directory of the pprz user inside the container.
That way you can edit your code and configuration files from your host system using your favourite tools/IDE and then build and use them within Docker.
In your local clone of the Paparazzi repository:
<source lang="bash">
./docker/run.sh -it flixr/pprz-dev bash
</source>
or even easier:
<source lang="bash">
cd docker
make bash
make bash
</source>
</source>
And you are in the docker paparazzi environment...
And you get a new bash shell inside the Paparazzi Docker container... There you can just run <tt>make</tt> to build Paparazzi.
Once built, you can also directly use <tt>make paparazzi</tt> or <tt>make start</tt> accordingly to start the Paparazzi Center or the start.py tool.


See also https://github.com/paparazzi/paparazzi/pull/1272
== Troubleshooting ==
When using the run.sh script, you are sharing the paparazzi directly between your host system and the Docker container. This means that if you previously had Paparazzi built on your host system, you will need to rebuild it inside the Docker environment (<tt>make clean && make</tt>).


[[Category:Testing]] [[Category:Software]]
[[Category:Testing]] [[Category:Software]]

Revision as of 12:30, 14 November 2015

Docker is an open platform used to build, ship, and run distributed applications. You can learn more about Docker by visiting its website, https://docker.com.

In particular, if you're just getting started using Docker with Paparazzi, we encourage you to make use of the following resources:

  • What is Docker - A page that will give you excelent high level overview of Docker and its purpose.
  • Documentation - Browse the online documentation and references to find information about Docker's various functions and tools.
  • Forums - If you need help, just ask! Docker has a great user community, with lots of people willing to help answer any questions you might have.
  • Mailing list - Another way to start a discussion and follow community activities.

For new users of Docker, those resources will provide you with most of the information you'll need to get familiar with the platform. Additional information pertaining to using Docker for Paparazzi can be found on this page.

You can test out Docker right now using a live online tutorial, try it out yourself: Linux / Mac.

We have some images and scripts to easily build/test Paparazzi within a container.

Pulling Paparazzi images

There are prebuilt images containing all the Paparazzi dependencies on Docker hub, which you can just pull:

docker pull flixr/pprz-dep
docker pull flixr/pprz-dev

Or in your local clone of the Paparazzi repository:

cd docker
make pull

The pprz-dep image contains all dependencies, the pprz-dev image adds some convenience stuff and a pprz user. Normally you will want to use the pprz-dev image.

Building and Running Paparazzi inside Docker

You can simply start a shell inside the pprz-dev container

docker run -it flixr/pprz-dev bash

You could now clone the paparazzi repo inside this container and build it. However this does not give you access to the X-Server, USB, etc..

To make Docker more useful to us and enable using and editing Paparazzi files from the host system, the repo contains a helper script. See also https://github.com/paparazzi/paparazzi/pull/1272

Starting a shell (or Paparazzi Center directly) through this script will enable access to the X-Server, USB devices and audio and set mount your current Paparazzi directory in the home directory of the pprz user inside the container. That way you can edit your code and configuration files from your host system using your favourite tools/IDE and then build and use them within Docker.

In your local clone of the Paparazzi repository:

./docker/run.sh -it flixr/pprz-dev bash

or even easier:

cd docker
make bash

And you get a new bash shell inside the Paparazzi Docker container... There you can just run make to build Paparazzi. Once built, you can also directly use make paparazzi or make start accordingly to start the Paparazzi Center or the start.py tool.

Troubleshooting

When using the run.sh script, you are sharing the paparazzi directly between your host system and the Docker container. This means that if you previously had Paparazzi built on your host system, you will need to rebuild it inside the Docker environment (make clean && make).