Lightsail And Docker

As Incode Software we’ve been starting to "dockerize" our applications, and with the advent of Amazon Lightsail I thought I’d quickly try to put it all together.

Here’s the steps:

  • Sign up for Lightsail

  • set up ssh

    • from the Lightsail account page, create a private key, and download the .pem file

    • using puttygen (or similar) load the .pem file then Conversions > Export OpenSSH key to create the id_rsa file

    • copy id_rsa to ~/.ssh and chmod +400 ~/.ssh/id_rsa

  • create an instance

    • base OS: Ubuntu 16.04

    • (as per this blog post), specify this launch script:

      sudo apt-get update
      sudo apt-get install -y apt-transport-https ca-certificates
      sudo apt-key adv --keyserver hkp:// \
                   --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
      echo "deb ubuntu-xenial main" | \
                   sudo tee /etc/apt/sources.list.d/docker.list
      sudo apt-get update
      sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
      sudo apt-get install -y docker-engine
      sudo service docker start
    • specify the ssh key pair created in previous step

    • specify instance plan ($5 a month may well suffice)

  • create a static IP address and assign to the instance

  • start the instance

  • (optionally), restart the instance (because of changes required after all that startup stuff).


  • ssh into the instance, eg:

    ssh ubuntu@
  • run up postgres backend (already uploaded to dockerhub):

    sudo docker run --name postgres -d incodehq/postgres

    The dockerhub/incodehq/postgres image is built using the Dockerfile from github/incodehq/docker-postgres.

  • run up the example isis app (already uploaded to dockerhub):

    sudo docker run                          \
            --name isis-app-dockertest       \
            --link postgres:db               \
            -e ISIS_OPTS=$ISIS_OPTS          \
            -p 80:8080                       \
            -d incodehq/isis-app-dockertest

    The dockerhub/incodehq/isis-app-dockertest image is built using the Dockerfile from github/incodehq/docker-isis-app-dockertest, which in turn has a copy of the WAR file as built from github/isisaddons/isis-app-dockertest app.

The app is exposed on port 80, so you should be able to access the app from a browser, eg:

December 21, 2016 lightsail docker apache-isis