Docker
Docker is a container platform.
It's open source but if you go to the site, you won't be able to tell, you can just find out about pricing there. After looking at docker.com, go to https://github.com/docker/docker and look for installation instructions there.
I am following their instructions to install on two Debian systems, one co-located and one at home.
I want to set up containers for Geonode and Geoserver.
I know how fiddly Geoserver can be (it runs in Tomcat) and so I want to isolate it from the Debian host it will run on.
I already have PostgreSQL 9.5 running directly on the host, but my only intended use is as a backend for PostGIS/Geoserver, so I will probably follow along with the instructions here and containerize it too.
So in preparation for using Docker. I removed PostgreSQL and Tomcat from my host server.
Orchestrating Geoserver with Docker and Fig
I have no idea what Fig is, yet.
Development on Mac
Set up a Vagrant machine to run an instance of MySQL. Make sure it has port 3306 open and set a root password. Install Docker for Mac and Kitematic.
Docker Hub
apt-get install docker-engine
Metadata
Get an id:
docker ps
Look at a container in detail
docker inspect id
See also /var/lib/docker/containers/id
Docker networking
Check ifconfig docker0 to see what the bridge address is on your docker server then as needed create a route on your router so that traffic can flow from your local computers into the docker instances running on the docker server.
If you have more than one docker server you have to make sure they don't both pick the same network ip range. If routes are already set up in the router docker should be able to find an unused subnet.
docker pull nginx
cd static-html-directory cat <<EOF > nginx.docker FROM nginx COPY static-html-directory /usr/share/nginx/html EOF
Place this file in the same directory as your directory of content ("static-html-directory"), run ., then start your container:
docker run --name some-nginx -d some-content-nginx
Owncloud
I want to run Owncloud, so I need these components
- Nginx (nginx)
- php 7 vinaocruz/php7-fpm-mysql
- Redis redis
- Owncloud (Owncloud is just some files so it does not need a separate docker container)
- MySQL (which runs on the host not in Docker)
Redis
Used by owncloud (via PHP) and by nginx. It needs some file space.
docker run --name redis-owncloud -d redis redis-server --appendonly yes
I need to learn more about persistent data.
php7-fpm-mysql
Using FPM allows us to uncouple PHP from the web server (and lets nginx run php code.) (It's like FastCGI if you know what that is.) It runs PHP as a separate service, so it can be in a separate Docker.
- It needs to know about the MySQL server.
- It needs to be able to find the owncloud files.
Nginx
- It needs to know about Redis.
- It needs to be able to find the owncloud files.
Linking it all together
Server: MySQL Create an owncloud database, with a user owncloud allowed full access to the database. Make sure that the Nginx server can connect to it through the private LAN. (I run MySQL on the Docker host.)
Source: Redis Start the Redis docker as a source
Source: PHP7 Start the FPM PHP7 docker as a source
Receiver: Nginx Start the Nginx docker as a receiver for the services from Redis and PHP7. Add environment settings to tell it how to find MySQL.