Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:docker:dev [2014/08/27 07:30] – [Building the images from Dockerfiles] 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 [[/ | ||
Line 7: | Line 7: | ||
The Dockerfiles for the KnowRob containers can be found in this repository: https:// | The Dockerfiles for the KnowRob containers can be found in this repository: https:// | ||
- | | + | <code bash> |
- | docker build -t knowrob/ | + | cd ~/docker/hydro-knowrob/ |
- | cd ~/ | + | docker build -t knowrob/ |
- | docker build -t knowrob/ | + | |
- | cd ~/docker/webapp | + | cd ~/ |
- | docker build -t knowrob/webrob | + | docker build -t knowrob/ |
+ | |||
+ | cd ~/docker/hydro-knowrob/ | ||
+ | docker build -t knowrob/ | ||
+ | |||
+ | cd ~/docker/webapps/ | ||
+ | docker build -t openease/ | ||
+ | |||
+ | cd ~/ | ||
+ | docker build -t openease/ | ||
+ | |||
+ | cd ~/ | ||
+ | docker build -t openease/knowrob | ||
+ | </ | ||
You can tag a version of an image using | You can tag a version of an image using | ||
- | docker tag 18df3323a0d8 | + | docker tag 18df3323a0d8 |
- | + | ||
- | ===== Running KnowRob and the Web application ===== | + | |
+ | ===== 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: | # interactive: | ||
docker run -t -P -i knowrob/ | docker run -t -P -i knowrob/ | ||
Line 24: | Line 57: | ||
# daemon mode: | # daemon mode: | ||
docker run -t -P -d knowrob/ | 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 ===== | ||
- | The approach is to use [[https:// | ||
- | There is one container per user (called < | + | ===== Managing |
- | The common | + | 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:// | ||
- | ==== Creating the user data containers ==== | ||
- | The user containers are built from the user_data Dockerfile. It basically just creates a user ' | ||
- | cd docker/ | ||
- | docker build -t knowrob/ | ||
- | docker run --name demo_data knowrob/ | ||
==== Updating the common data container ==== | ==== Updating the common data container ==== | ||
The knowrob_data image is automatically built whenever new data is pushed to the [[https:// | The knowrob_data image is automatically built whenever new data is pushed to the [[https:// | ||
+ | <code bash> | ||
docker pull knowrob/ | docker pull knowrob/ | ||
docker rm knowrob_data | docker rm knowrob_data | ||
docker run --name knowrob_data knowrob/ | docker run --name knowrob_data knowrob/ | ||
+ | </ | ||
+ | |||
==== Starting a user container that includes the data volumes ==== | ==== 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: | ||
+ | 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 | # interactive mode | ||
- | docker run -t -P -i \ | + | docker run -t -P -i --rm \ |
| | ||
- | | + | |
| | ||
+ | | ||
| | ||
/ | / | ||
| | ||
# daemon mode | # daemon mode | ||
- | docker run -t -P -d \ | + | docker run -t -P -d --rm\ |
| | ||
- | | + | |
| | ||
+ | | ||
| | ||
- | + | | |
- | These examples are for the user ' | + | These examples are for the user ' |
- | + | ||
- | ==== Starting MongoDB ==== | + | |
- | + | ||
- | 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 a 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: | + | |
- | docker run -t -P --rm --link mongo_db: | + | |
- | -v / | + | |
- | -i knowrob/ | + | |
- | + | ||
- | Then you can run the ' | + | |
- | mongoimport --host " | + | |
- | + | ||
- | ==== Starting the web app in a container ==== | + | |
- | + | ||
- | The web app needs access to the Docker socket, so you have to start it like this: | + | |
- | docker run --rm -i -p 5000:5000 -v / | + | |
- | + | ||
- | You can then access the Web interface at http:// | + | |
- | + | ||
- | + | ||
- | ==== Pulling the containers manually ==== | + | |
- | + | ||
- | docker pull knowrob/ | + | |
- | docker pull knowrob/ | + | |
- | docker pull knowrob/ | + | |
- | docker pull knowrob/ | + | |