简体   繁体   中英

Running GeoNode with docker-compose

I'm trying to run GeoNode on a VPS, and expose it to the internet, using docker-compose.

The GeoNode tutorial on docker-compose has quite clear instructions on running it locally. It also has instructions for running it on the docker IP, which, if I understand things correctly, is not a good idea in production, because that's the IP the docker daemon listens on, so I wouldn't want to expose that.

So what's a good setup for running GeoNode on a single machine, running Ubuntu, using docker-compose?

While I've toyed with docker before, I'm quite new to it, so I'm probably just misunderstanding something.

If you only want to run GeoNode on the vps and nothing else, you can just expose port 80 geonode/nginx:geoserver from the docker compose file you linked. The way the base docker-compose.yml in the repo is set up is it will expose port 80 from the container on the host - very much the same way as if you would start an nginx or apache to listen on port 80 on all interfaces on that server. After that, you would be able to connect from clients using the public ip address from the vps.

If you want to run multiple different services on the same host using docker-compose, you'll need some kind of proxy to do the "routing" of different subdomains to different containers. You could achive that with a classic nginx installed on the vps itself or with something like this image . For the "classic" way with nginx you would need to make some adjustments to the ports configuration of the docker-compose.yml file to expose the port on the host only. Something like this:

...
  geonode:
    image: geonode/nginx:geoserver
...
    ports:
      - "127.0.0.1:8081:80"
...

This would make port 80 from inside the container available on port 8081 on the host, but only on the local interface. You will then need something like nginx to proxy the request from the outside world to 127.0.0.1:8081 .

If you didn't configure it otherwise, the docker daemon listens on a local socket, not on the ip so it is safe to expose a port from a docker image to "the outside world".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM