Skip to content

Instantly share code, notes, and snippets.

@annawinkler
Last active October 10, 2018 19:19
Show Gist options
  • Save annawinkler/90ff6bc30f7e23b05dddf31933be92c3 to your computer and use it in GitHub Desktop.
Save annawinkler/90ff6bc30f7e23b05dddf31933be92c3 to your computer and use it in GitHub Desktop.
How to create a google cloud compute instance from a docker image???

Well this did not work:

This is what I found: https://stackoverflow.com/questions/50881454/is-there-a-way-to-directly-deploy-a-container-from-docker-hub-to-google-compute

So then I updated the reference to this: registry.hub.docker.com/r/sebp/elk/

That also did not work, so I tried verifying on the command-line via docker pull commands, and got this one to work: docker pull index.docker.io/sebp/elk

Name: es-test
Region: us-central1 / us-central1-c
Machine type: 2 vCPUs
Container image: index.docker.io/sebp/elk
Select: Allocate a buffer for STDIN, ALlocate a pseudo-TTY

Add container environment variables:

MAX_MAP_COUNT=262144
ES_HEAP_SIZE=1G
LS_HEAP_SIZE=2G

Create firewall rules:

  • name: elasticsearch

  • source IP ranges: 0.0.0.0/0

  • targets: All instances in the network

  • specified protocols and ports: tcp: 9200

  • name: kibana

  • source IP ranges: 0.0.0.0/0

  • targets: All instances in the network

  • specified protocols and ports: tcp: 5601

  • name: logstash

  • source IP ranges: 0.0.0.0/0

  • targets: All instances in the network

  • specified protocols and ports: tcp: 5044

Next issue: Ran into this error: [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] https://www.elastic.co/guide/en/elasticsearch/reference/5.0/vm-max-map-count.html#vm-max-map-count

Reading the Google Cloud docs (https://cloud.google.com/compute/docs/images/building-custom-os), it looks like CONFIG_DEFAULT_MMAP_MIN_ADDR is set to 65536. How to change this??

To verify on a system what the value is set to, run this command: sysctl vm.max_map_count

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment