Public Repository

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description

A Docker container running GeoServer, based on an publicly available image on the Kartoza repository (https://hub.docker.com/r/kartoza/geoserver/). The image has been realized for educational purposes using another image, PostgreSQL/PostGIS (link), to work together as a support and testing software for a personalized demo of web mapping. The use of the application requires the simultaneous run of two containers created with the reference image.

To build the application geoserver/www/demo:

  1. download the directory “edugeo” from Bitbucket with
    git clone https://bitbucket.org/mfortunato/edugeo_dir
  2. from the shell, run the commands
    cd edugeo_dir/edugeo
    docker-compose up -d
  3. type in the browser address bar
    localhost:8080/geoserver/www/demo/mapindex.html
    4.Enjoy it!

Note: this image has more tags associated with it. We recommend the use of the final version, with lst tag.

GET IMAGES AND RUN CONTAINERS

The easiest method to download images on your system consists of:

docker pull mfortunato/geoserver
docker pull mfortunato/postgis

While, for the creation of running containers, the commands are:

sudo docker run --name "postgis" -d -t  mfortunato/postgis
sudo docker run --name "geoserver" --link postgis:postgis -p 8080:8080 -d -t mfortunato/geoserver

To simplify, it is recommended to use a .yml script which makes the downloading of images, the creation of the two containers, their connection and their start-up, in a single step. The script must be launched with the tool Docker Compose (link).

The used docker-compose.yml file contains the following script:

postgis:
 image: mfortunato/postgis:lst
geoserver:
 image: mfortunato/geoserver:lst
 ports:
 - "8080:8080"
 links: 
- postgis
volumes: 
- $PWD/www:/opt/geoserver/data_dir/www/

Two containers are defined, as "postgis" and "geoserver"; this is the same value that is associated with the flag --name of docker run described above. For each container is defined the starting image (eg. image: mfortunato/postgis:lst). In the case of "geoserver", it is also defined the matching of the ports (ports:-"8080:8080") and the link with the “postgis” container (links:-postgis). The option volumes connects the www folder to the /opt/geoserver/data_dir/www/ position, in the "geoserver" container. So it becomes a shared folder between the host and the container.

The .yml files must be placed in a edugeo named folder. The folder, containing the docker-compose.yml file and the www folder. The edugeo folder can be downloaded locally from a Bitbucket repository, with shell command:

git clone https://bitbucket.org/mfortunato/edugeo_dir

After, get in edugeo directory through terminal and give the docker-compose up -d command. To close the session, use docker-compose stop. These commands must be run in the directory that contains docker-compose.yml.

Note: GeoServer default user is "admin" and the password is "geoserver"; while PostgreSQL default user is "docker" with “docker” password. Both are editable. The access to PostGIS can be done via pfm (Form Postgres), after making sure you have installed it on your host (sudo apt-get install pfm). GeoServer is accessible via GUI by typing in browser: localhost:8080/geoserver/web.

STORING DATA ON DOCKER VOLUME

Docker volumes can be used to share a folder between host and container. Inside edugeo, in addition to .yml files, there is a www folder, intended to serve as a volume. The folder is named www because it create a shared folder between the container GeoServer and the edugeo folder, replacing a folder with the same name on existing path (/opt/geoserver/data_dir/www/). WWW is a GeoServer default directory, needed to run the web map client. The creation of a volume within a pre-existing folder, delete all the files in the same folder, replacing them with those of volume-folder. For this reason it was decided to add into the www folder of edugeo also the default files inside the www folder at the installation of GeoServer, so that the same functions are maintained.

In the case of the use of docker-compose.yml file described above, the volume is automatically built with containers, by running docker-compose up -d command. Changing the contents of the local folder, the change also occurs in the same folder within the container.

LICENCE

GeoServer licensed under the GPL.

Docker Pull Command
Owner
mfortunato

Comments (0)