Getting started with Docker¶
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.
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.
You can pull the latest Tomahawk image using
docker pull mklarqvist/tomahawk
You can then run Tomahawk directly from that image.
docker run -v /var/data/:/data latest mklarqvist/tomahawk:latest tomahawk calc -pi input.twk -o output.two
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
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
shell session within a Tomahawk container:
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
Success: You now know how to use containerized Tomahawk.