forked from xdocker/xgeoserver

Tim Sutton
2014-10-10 da33c634afb3ac89e7a1aa7230d4162791d21bb2
README.md
@@ -1,47 +1,85 @@
Geoserver in Docker
===================
# docker-geoserver
A simple docker container that runs tilemill (https://github.com/mapbox/tilemill).
**Note** This docker project is still in development and may not work for
    you yet!
To build the image do:
A simple docker container that runs Geoserver influenced by this docker
recipe: https://github.com/eliotjordan/docker-geoserver/blob/master/Dockerfile
**Note:** We recommend using ``apt-cacher-ng`` to speed up package fetching -
you should configure the host for it in the provided 71-apt-cacher-ng file.
## Getting the image
There are various ways to get the image onto your system:
The preferred way (but using most bandwidth for the initial image) is to
get our docker trusted build like this:
```
docker.io build -t kartoza/tilemill git://github.com/timlinux/docker-tilemill
docker pull kartoza/geoserver
```
To run a container do:
To build the image yourself without apt-cacher-ng (also consumes more bandwidth
since deb packages need to be refetched each time you build) do:
```
docker.io run --name=tilemill -p 1100:22 -p 20008:20008 -p 20009:20009 -d -t kartoza/tilemill
docker build -t kartoza/geoserver git://github.com/kartoza/docker-geoserver
```
Perhaps you might also want to link to a docker container running postgres (see
https://github.com/timlinux/docker-postgis) and / or to mount your local ~/Documents/Mapbox in
the container and then work on data from your local filesystem.
To use the container, open your browser at:
To build with apt-cacher-ng (and minimised download requirements) do you need to
clone this repo locally first and modify the contents of 71-apt-cacher-ng to
match your cacher host. Then build using a local url instead of directly from
github.
```
http://localhost:2009
git clone git://github.com/kartoza/docker-geoserver
```
**Note**: The maptiles in the example projects take quite a long time
to render the first time you spin up the docker container, just open a project, be patient,
it should work after a few minutes!
To log into your container via ssh do:
Now edit ``71-apt-cacher-ng`` then do:
```
ssh root@localhost -p 1000
docker build -t kartoza/postgis .
```
Default password will appear in docker logs:
## Run
You probably want to also have postgis running too. To create a running
container do:
```
docker logs <container name> | grep root login password
sudo docker run --name "postgis" -d -t kartoza/postgis
sudo docker run --name "geoserver"  --link postgis:postgis -p 8080:8080 -d -t kartoza/geoserver
```
-----------
You can also use the following environment variables to pass a
user name and password. To postgis:
Tim Sutton (tim@linfiniti.com)
* -e USERNAME=<PGUSER>
* -e PASS=<PGPASSWORD>
These will be used to create a new superuser with
your preferred credentials. If these are not specified then the postgresql
user is set to 'docker' with password 'docker'.
## Storing data on the host rather than the container.
Docker volumes can be used to persist your data.
```
mkdir -p ~/geoserver_data
docker run -d -v $HOME/geoserver_data:/opt/geoserver_data kartoza/geserver
```
You need to ensure the ``geoserver_data`` directory has sufficinet permissions
for the docker process to read / write it.
## Credits
Tim Sutton (tim@kartoza.com)
May 2014