Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
doc:docker:dev [2014/08/27 07:17] – created admin | doc:docker:dev [2015/03/31 12:51] (current) – [Sharing images via Docker hub] daniel86 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== KnowRob & Docker | + | ====== KnowRob & Docker -- developer documentation ====== |
+ | |||
+ | This page lists information for developers that would like to modify, update and develop the docker images. If you would only like to start the existing docker containers, please have a look [[/ | ||
+ | |||
+ | |||
+ | ===== Building Docker images===== | ||
+ | |||
+ | The Dockerfiles for the KnowRob containers can be found in this repository: https:// | ||
+ | <code bash> | ||
+ | cd ~/ | ||
+ | docker build -t knowrob/ | ||
+ | |||
+ | cd ~/ | ||
+ | docker build -t knowrob/ | ||
+ | |||
+ | cd ~/ | ||
+ | docker build -t knowrob/ | ||
+ | |||
+ | cd ~/ | ||
+ | docker build -t openease/ | ||
+ | |||
+ | cd ~/ | ||
+ | docker build -t openease/ | ||
+ | |||
+ | cd ~/ | ||
+ | docker build -t openease/ | ||
+ | </ | ||
+ | |||
+ | You can tag a version of an image using | ||
+ | docker tag 18df3323a0d8 openease/ | ||
+ | |||
+ | ===== Sharing images via Docker hub ===== | ||
+ | Instead of building all images from Dockerfiles, | ||
+ | |||
+ | <code bash> | ||
+ | # upload image: | ||
+ | docker push knowrob/ | ||
+ | |||
+ | # download images (this can also be done with the ' | ||
+ | docker pull knowrob/ | ||
+ | docker pull knowrob/ | ||
+ | docker pull knowrob/ | ||
+ | docker pull openease/ | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Running Docker containers ===== | ||
+ | |||
+ | ==== KnowRob containers ==== | ||
+ | |||
+ | There are two versions of the KnowRob container: The interactive one starts a Bash shell that can be used for console-based interaction with the system. The other one is a daemonized version that starts KnowRob and json_prolog as a daemon without interactive shell. | ||
+ | <code bash> | ||
+ | # interactive: | ||
+ | docker run -t -P -i knowrob/ | ||
+ | |||
+ | # daemon mode: | ||
+ | docker run -t -P -d knowrob/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== MongoDB ==== | ||
+ | <code bash> | ||
+ | docker run -d -v /data/db --name mongo_data busybox true | ||
+ | docker run -d -p 27017:27017 --volumes-from mongo_data --name mongo_db mongo | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Importing data into MongoDB === | ||
+ | |||
+ | If you want to import data into a dockerized MongoDB instance, first start an interactive container that mounts the host directory which contains the exported json files: | ||
+ | <code bash> | ||
+ | docker run -t -P --rm --link mongo_db: | ||
+ | -v / | ||
+ | -i knowrob/ | ||
+ | </ | ||
+ | Then you can run the ' | ||
+ | <code bash> | ||
+ | cd / | ||
+ | mongoimport --host " | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Managing data using containers ===== | ||
+ | |||
+ | Docker containers are cheap and usually short-lived, | ||
+ | |||
+ | In the KnowRob use case, there is one container for user data (called user_data), and another one for common data (called knowrob_data). The user container will serve as sandbox in which users can store their files, the knowrob_data container will provide commonly used data sets. The common data container knowrob_data is [[https:// | ||
+ | |||
+ | |||
+ | ==== Updating the common data container ==== | ||
+ | The knowrob_data image is automatically built whenever new data is pushed to the [[https:// | ||
+ | |||
+ | <code bash> | ||
+ | docker pull knowrob/ | ||
+ | docker rm knowrob_data | ||
+ | docker run --name knowrob_data knowrob/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Starting a user container that includes the data volumes ==== | ||
+ | |||
+ | If the KnowRob image has been built as described earlier, it can be started using the following command such that both the common and the user-specific data volumes are mounted: | ||
+ | <code bash> | ||
+ | # interactive mode | ||
+ | docker run -t -P -i --rm \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | / | ||
+ | |||
+ | # daemon mode | ||
+ | docker run -t -P -d --rm\ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | These examples are for the user ' | ||