Hyper Docs
  • Introduction
  • What is Hyper
  • Why Hyper
  • Regions
  • Pricing
  • Quota and Limits
  • FAQ
  • Getting Started
    • Generate API Credential
    • Install CLI
    • Part 1 - Starting and inspecting your first container
    • Part 2 - Working with multiple containers
    • Part 3 - Hyper Compose
    • Migrate data
      • hyper container as client
      • hyper container as server
  • Features
    • Container
      • Container
      • Logs
      • Compose
      • Cron
      • Service
      • Func
    • Storage
      • Volume
      • Snapshot
    • Network
      • Network
      • Floating IP
      • Port
      • Security Group
    • Console
      • Filter
  • Reference
    • CLI
      • attach
      • commit
      • config
      • create
      • exec
      • images
      • info
      • inspect
      • kill
      • load
      • login
      • logout
      • logs
      • port
      • ps
      • pull
      • push
      • rename
      • restart
      • rm
      • rmi
      • run
      • search
      • start
      • stats
      • stop
      • version
      • update
      • wait
      • Volume
        • create
        • init
        • inspect
        • ls
        • rm
      • Snapshot
        • create
        • ls
        • rm
      • FIP
        • allocate
        • attach
        • detach
        • ls
        • release
        • name
      • Security Group
        • create
        • ls
        • inspect
        • rm
        • update
      • Compose
        • create
        • down
        • up
        • rm
        • ps
        • pull
        • run
        • kill
        • start
        • stop
        • scale
      • Service
        • create
        • ls
        • inspect
        • scale
        • rolling-update
        • attach-fip
        • detach-fip
        • rm
      • Cron
        • create
        • inspect
        • ls
        • history
        • rm
      • Func
        • create
        • update
        • inspect
        • ls
        • rm
        • logs
        • call
        • get
    • API
      • 2016-04-04 [Ver. 1.23]
        • Container
          • List Containers
          • Create a container
          • Get container logs
          • Start a container
          • Stop a container
          • Restart a container
          • Resize a container
          • Rename a container
          • Kill a container
          • Attach to a container
          • Remove a container
          • Update a container
          • Get container stats
          • Inspect a container
          • Exec Create
          • Commit a container
        • Event
          • Monitor events with WebSocket
        • Misc
          • Display system-wide information
          • Show the hyper version information
          • Exec Start
          • Exec Resize
          • Exec Inspect
        • Image
          • Inspect Images
          • Search Images
          • List Images
          • Load Images
          • Create an image
          • Remove an image
          • Push an image
        • Volume
          • List volumes
          • Create a volume
          • Remove a volume
          • Init a volume
          • Inspect a volume
        • Snapshot
          • Create a snapshot
          • List snapshots
          • Inspect a snapshot
          • Remove a snapshot
        • Network
          • Allocate floating IP
          • Attach a floating IP to a (running) container
          • Detach floating IP from a (running) container
          • List floating IP
          • Release floating IP
          • Name floating IP
        • Security Group
          • Create a security group
          • Remove a security group
          • Inspect a security group
          • Update a security group
          • List security groups
        • Service
          • service create
          • service list
          • service inspect
          • service update
          • service remove
        • Compose
          • Compose up
          • Compose create
          • Compose down
          • Compose rm
          • Compose start
          • Compose stop
          • Compose kill
        • Cron
          • Cron create
          • Cron list
          • Cron inspect
          • Cron remove
          • Cron history
        • Func
          • Func create
          • Func update
          • Func list
          • Func inspect
          • Func remove
          • Func call
          • Func get
          • Func logs
          • Func status
    • Compose File Reference
    • Security Group Reference
  • FAQ
    • Pricing
    • Quota and Limits
    • Privacy Policy
    • Terms of Service
    • Acceptable Use Policy
  • Docs version
Powered by GitBook
On this page
  • Hyper Compose for a single container
  • Hyper Compose for multiple containers
  • Conclusion
  1. Getting Started

Part 3 - Hyper Compose

PreviousPart 2 - Working with multiple containersNextMigrate data

Last updated 7 years ago

In part 2 we saw how to get containers to interact with each other in Hyper using the --link flag of the hyper run command. That works fine, but you have many containers working together it can be tedious to create and manage them using only the CLI. Docker solved this problem with Docker Compose, and Hyper Compose works in exactly the same way.

Hyper Compose for a single container

Let’s start by using Hyper Compose to start the single container example that we saw in Part 1. As with Docker Compose, we need a compose file:

version: '2'
services:
  jenkins:
    image: jenkins
    size: s4
    ports:
      - "8080:8080"
    fip: <INSERT YOUR FIP HERE>

Note on the term ‘service’ You’ll notice in the Docker Compose format that each container is referred to as a ‘service:’. This is not the same as the Hyper Service functionality which is outside of the scope of this guide. You can read more about Hyper Service in the docs here:

Above you can see that Hyper Compose and Docker Compose have pretty much the same format. In fact in most cases you can just run an existing Docker Compose file using Hyper Compose. The size and FIP fields are not present in Docker Compose, but as we’ve seen earlier in this guide, these are specific to Hyper.

Let’s save the compose file locally as myfirstcompose.yml and try it out. Remember to insert your own FIP!

hyper compose up -f myfirstcompose.yml
Project [markcoleman]: Starting project
Project [markcoleman]: Project started
(Output cut to save space)
jenkins-1 | --> setting agent port for jnlp
jenkins-1 | --> setting agent port for jnlp... done
...
jenkins-1 | *************************************************************
jenkins-1 | *************************************************************
jenkins-1 | *************************************************************
jenkins-1 |
jenkins-1 | Jenkins initial setup is required. An admin user has been created and a password generated.
jenkins-1 | Please use the following password to proceed to installation:
jenkins-1 |
jenkins-1 | ad07e5fcddaf43d3963f1550d0ad4f68
jenkins-1 |
jenkins-1 | This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
jenkins-1 |
jenkins-1 | *************************************************************
jenkins-1 | *************************************************************
jenkins-1 | *************************************************************
...

And that’s it. The Jenkins example that we looked at in Part 1 will now be up and running and accessible on <YOUR FIP>:8080

Note on changing compose files If you want to make a change to your compose file, remember to first run hyper compose down, and then hyper compose up again to make sure that all changes are processed correctly.

Lastly, we’ll stop the container by using the hyper compose down command.

Note on external volumes with Hyper Compose As you start to use Hyper Compose you’ll be able to get work much more quickly, but you’ll also be able to create lots of volumes. Make sure to use hyper volume ls afterwards to check which Hyper Volumes and lying around and hyper volume rm to remove those that you no longer need.

Hyper Compose for multiple containers

Now that you’re familiar with Hyper Compose, let’s use the Wordpress example from Part 2 to look at a multi-container Hyper Compose example. Here’s the compose file:

version: '2'
services:
  mywordpress:
    image: wordpress:latest
    fip: <INSERT YOUR FIP HERE>
    links:
      - mysqldb:mysql
    depends_on:
      - mysqldb
    ports:
      - "8080:80"
  mysqldb:
    image: mysql:5.7
    environment:
        - MYSQL_ROOT_PASSWORD=12345678

As you can see, we have added two ‘services’ in this example, MySQL and Wordpress and the compose file parameters are exactly the same as those we used via the CLI in Part 2.

The depends_on field makes sure that the mysqldb service is started before the Wordpress container. You can now save the above compose file locally and start the whole Wordpress application using the following command:

hyper compose up -f mywordpress_compose.yml
Project [markcoleman]: Starting project
Project [markcoleman]: Project started
(Output cut to save space)

And that’s it! You will now have your Wordpress application running and accessible publicly via your FIP.

Note on output from Hyper Compose Most of the time you probably will not want to stream all output from Hyper Compose to standard err/out. To stop this you can add the -d flag to the hyper compose up command. You can then use hyper logs on the individual containers to see their output.

Conclusion

In Part 3 we’ve looked at two examples of how to use Hyper Compose to manage more complex stacks. You can find the full documentation for Hyper Compose here:

And for now, that's it. If you want to learn you're advised to look through the and the .

We wish you happy hacking on Hyper, but if you think that we've missed anything from the getting started guide please do tell us via the , or on .

https://docs.hyper.sh/Feature/container/service.html
https://docs.hyper.sh/Feature/container/compose.html
documentation
blog
Hyper console
the forum
Twitter