This directory contains docker configurations for some of OpenCog's projects. Following are instructions on how to get started with using docker for opencog development.
- Initial Setups
- UNIX like Systems
- windows
- Steps for OpenCog development
- Steps for RelEx development
- Steps for opencog-to-minecraft development
The following sub-sections describe the steps required to configure docker on your os, regardles of which project you are working on.
-
Follow the instruction here for setting docker,
-
Build images using
./docker-build.sh [OPTIONS]
- For opencog development use
-bctp
option - For NLP related work use
-r
option - For opencog-to-minecraft use
-bcte
option - If you want to update your images add
-u
option. For example for opencog development use-ctu
options. Unless there are some system dependency changes, you don't have to updateopeoncog/opencog-deps
image. - To list the available options use
-h
- For opencog development use
-
The following is required only if you want to use docker-compose setup that is described below
# The following is required only the first time or when updating sudo pip install -U docker-compose
-
Run docker using whichever setup you are accustomed to. If you want to use docker-compose, follow the steps below, as per your type of development. The docker-compose setup enables you to persist changes you make on the opencog repos, from within the container, to your host OS, even when you choose to remove the containers.
-
Follow the instruction
here for setting docker, -
Start the docker virtual machine using 'Docker Quickstart Terminal' as described in the linked web-page from the previous step,
-
Build images using
./docker-build.sh [OPTIONS]
- For opencog development use
-bctp
option - For NLP related work add
-r
option - If you want to update your images add
-u
option. For example for opencog development use-ctu
options. Unless there are some system dependency changes, you don't have to updateopeoncog/opencog-deps
image. - To list the available options use
-h
- For opencog development use
-
In the script
windows-run.sh
found in the same directory as this README, Replace '$HOME/path/to/' in the export command to the appropriate absolute path on your windows machine. Note that you don't have to clone each repository or add all the paths, just those you need. Since you will be using the MINGW environment that was setup by the first step, use UNIX path naming format. -
Run
./windows-run.sh
.
For UNIX like systems only, and if you choose to use docker-compose
-
Specify a directory for storing ccache's compiler outputs on your host OS
mkdir -p $HOME/path/to/where/you/want/to/save/ccache/output export CCACHE_DIR=$HOME/path/to/where/you/want/to/save/ccache/output`
Specifying this means, making a clean build of source code after removing a container will be faster. If you don't want to do this, then comment out the
- $CCACHE_DIR:/home/opencog/.ccache
incommon.yml
file -
Add these lines to
~/.bashrc
at $HOME of your host OS and runsource ~/.bashrc
.export OPENCOG_SOURCE_DIR=$HOME/path/to/opencog export ATOMSPACE_SOURCE_DIR=$HOME/path/to/atomspace export COGUTILS_SOURCE_DIR=$HOME/path/to/cogutils export OC2MC_SOURCE_DIR=$HOME/path/to/opencog-to-minecraft
Optionally, if you are using
moses
add to~/.bashrc
,export MOSES_SOURCE_DIR=$HOME/path/to/moses
and uncomment- $MOSES_SOURCE_DIR:/moses
line in the docker-compose.yml file. -
For starting the containers using docker-compose run either of the following commands,
- If you want to map container ports to host run
docker-compose run --service-ports dev
- If you don't want to map ports to host run
docker-compose run dev
-
For using opencog shells follow instruction here
-
For configuring RelEx in the cogserver run
cat /etc/hosts
# take note of the ip address for relex, e.g.172.17.0.69 relex 8e7dc3a09f12 opencog_relex_1
/tmp/octool -bi
# Build and install opencog- start the cogserver, telnet into it and access the scheme shell.
(use-modules (opencog nlp) (opencog nlp chatbot) (opencog nlp relex2logic))
(set-relex-server-host)
(nlp-parse "you know what this is.")
-
have fun hacking
-
exit container
For UNIX like systems only, and if you choose to use docker-compose
-
Add these lines to
~/.bashrc
at $HOME of your PC and runsource ~/.bashrc
.export RELEX_SOURCE_DIR=$HOME/path/to/relex
-
For starting the containers run either of the following commands,
- If you want to map container ports to host run
docker-compose -f relex.yml run --service-ports relex
- If you don't want to map ports to host run
docker-compose -f relex.yml run relex
For UNIX like systems only, and if you choose to use docker-compose
-
Add these lines to
~/.bashrc
at $HOME of your PC and runsource ~/.bashrc
.export OPENCOG_SOURCE_DIR=$HOME/path/to/opencog export ATOMSPACE_SOURCE_DIR=$HOME/path/to/atomspace export COGUTILS_SOURCE_DIR=$HOME/path/to/cogutils export OC2MC_SOURCE_DIR=$HOME/path/to/opencog-to-minecraft
-
To start the Minecraft server and access a configured development environment run
docker-compose -f minecraft.yml run oc2mc
. The server.properties file is found inminecraft/data
in the same folder as this README. The file is auto-generated so on changing the entries, restart the server by runningdocker restart minecraft-server
. -
Run
tmux
inside the container for working with multiple windows/panes. If you create multiple panes you can use your mouse as an alternative to switch between panes. -
Open a separate terminal, on your host, run
docker attach minecraft-server
. This gives you access to the server's console that is used for configuration. -
Except PYTHONPATH setting step, which isn't needed because it is already configured inside the container, follow the steps described here
WIP and only for use with systems with gpus, for now
-
Install nvidia docker plugin by following instruction here.
-
Build openog/perception image by running
docker build -t opencog/perception perception/
from this directory. -
For usage of the built image see here.
-
Tmux is preinstalled so you can use it for multiple windows/panes.
-
On exiting opencog container, postgres & relex will still be running in the background. So when running
docker-compose run ...
it will auto-link to them, provided you haven't removed the containers or shutdown your machine. -
For more on docker-compose refert to https://docs.docker.com/compose/