Skip to content

Getting started with Docker

About

Docker uses operating-system-level virtualization into "containers". With Docker we can create virtual environments that isolate a Tomahawk installation from the rest of the system. Tomahawk programs are run within this virtual environment that can share resources with its host machine. The Tomahawk Docker images are tested for each release.

Prerequisites

To follow this tutorial, you will need the following:

  • One Ubuntu 18.04 server set up by following the Ubuntu 18.04 initial server setup guide, including a sudo non-root user and a firewall.
  • An account on Docker Hub if you wish to create your own images and push them to Docker Hub, as shown in Steps 7 and 8.

Getting started

You can pull the latest Tomahawk image using

1
docker pull mklarqvist/tomahawk

You can then run Tomahawk directly from that image.

1
docker run -v /var/data/:/data latest mklarqvist/tomahawk:latest tomahawk calc -pi input.twk -o output.two

Tutorial complete

Note: You now know how to use containerized Tomahawk.

You can run detach the docker instance so that it runs in the background by passing the -d flag.

1
docker run -d -v /var/data/:/data latest mklarqvist/tomahawk:latest tomahawk calc -pi input.twk -o output.two

Let's demonstrate some more Tomahawk Docker recipes. You can start a bash shell session within a Tomahawk container:

1
docker run -it -v /var/data/:/data latest mklarqvist/tomahawk:latest

Within the container you can interactively run the tomahawk CLI or develop using the C++ API.

If you want to stop and cancel a running docker instance then run docker ps to retrieve the target container id (first column) and execute docker stop CONTAINER_ID.

Tutorial complete

Success: You now know how to use containerized Tomahawk.