Orchestrate GeoNode stack with Docker Compose¶
Docker Compose is a tool for defining and running multi-container Docker applications automatically. This tool relies on Docker daemon so make sure you have completed successfully the section on _setup_docker.
Introducing main concepts¶
In a composed application, different pieces of the application are called services. A service runs just one image but it specifies how that image is executed, what ports have to be used, which containers are depending each other, which volumes and so on.
A stack is a group of interrelated services that share dependencies, and can be orchestrated and scaled together. A single stack is capable of defining and coordinating the functionality of an entire application like GeoNode.
Install Docker Compose on Ubuntu¶
Download the latest version of docker-compose binary:
sudo curl -L \
https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` \
-o /usr/local/bin/docker-compose
Adjust executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Verify the installation:
docker-compose --version
Running GeoNode stack on localhost¶
Clone the repository:
git clone https://github.com/GeoNode/geonode.git
Launch the stack with the build of GeoNode so any changes you did will be immediately available:
docker-compose -f docker-compose.yml -f docker-compose.override.localhost.yml up --build
Note
docker-compose.override.localhost.yml containse environment variables to allow you run the instances on localhost. You can use this file as template in order to run on other public addresses.
Note
For Windows users: In case you’re using the native Docker for Windows (on Hyper-V) you will probably be affected by an error related to mounting the /var/run/docker.sock volume. It’s due to a problem with the current version of Docker Compose for Windows. In this case you need to set the COMPOSE_CONVERT_WINDOWS_PATHS environmental variable:
set COMPOSE_CONVERT_WINDOWS_PATHS=1
before running docker-compose up
Running GeoNode stack on docker ip address¶
If you want to navigate the application from the address of the Docker socket than run simply:
docker-compose up --build
Note
For Windows users: In case you’re using the native Docker for Windows (on Hyper-V) you will probably be affected by an error related to mounting the /var/run/docker.sock volume. It’s due to a problem with the current version of Docker Compose for Windows. In this case you need to set the COMPOSE_CONVERT_WINDOWS_PATHS environmental variable:
set COMPOSE_CONVERT_WINDOWS_PATHS=1
before running docker-compose up
GeoNode will be available at the ip address of the docker0 interface:
ifconfig -a