Docker basics with Geodocker GeoServer
Today’s post is mostly notes-to-self about using Docker. These steps were tested on a fresh Ubuntu 17.04 install.


Install Docker as described in https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ “Install using the repository” section.
Then add the current user to the docker user group (otherwise, all docker commands have to be prefixed with sudo)
$ sudo gpasswd -a $USER docker $ newgrp docker
Test run the hello world image
$ docker run hello-world
For some more Docker basics, see https://github.com/docker/labs/blob/master/beginner/chapters/alpine.md.
Pull Geodocker images, for example from https://quay.io/organization/geodocker
$ docker pull quay.io/geodocker/base $ docker pull quay.io/geodocker/geoserver
Get a list of pulled images
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE quay.io/geodocker/geoserver latest c60753e05956 8 months ago 904MB quay.io/geodocker/base latest 293209905a47 8 months ago 646MB
Test run quay.io/geodocker/base
$ docker run -it --rm quay.io/geodocker/base:latest java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
Run quay.io/geodocker/geoserver
$ docker run --name geoserver -e AUTHOR="Anita" \ -d -P quay.io/geodocker/geoserver
The important options are:
-d … Run container in background and print container ID
-P … Publish all exposed ports to random ports
Check if the image is running
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 684598b57868 quay.io/geodocker/geoserver "/opt/tomcat/bin/c..." 2 hours ago Up 2 hours 0.0.0.0:32772->9090/tcp geoserver
You can also check which ports to access using
$ docker port geoserver 9090/tcp -> 0.0.0.0:32772
Geoserver should now run on http://localhost:32772/geoserver/ (user=admin, password=geoserver)
For more tests, let’s connect to Geoserver from QGIS
All default example layers are listed
and can be loaded into QGIS
Cool! More info I’d love to see: a) Your Dockerfile b) The default port internal to the image so I can use -p to consistently map it to a known port. c) Would be great to see this on Docker Hub/Cloud so I can do easy security scanning
Thanks for your comment Mano! I guess the info your looking for is in https://github.com/geodocker/geodocker-geoserver/blob/master/Dockerfile.
I’m just starting out but the devs are on https://gitter.im/geodocker/geodocker.
Excellent! docker run –name geoserver -e AUTHOR=”Anita” \
-d -p 9090:9090 quay.io/geodocker/geoserver gives me consistently localhost:9090/geoserver.
That’s great!
Thanks for your excellent article (as usual)