What is a Container?


Before you learn more about containers and what they are, you must first understand the software used for running them.

Docker is a software package available for use on Windows, Linux and Mac. It is a tool which makes it easier to create, deploy and run applications. You could look at Docker a lot like a virtual machine, however, rather than it creating a virtualised Operating System (OS), your software will use the same kernel as its base system is running on.
Docker launched in 2013, and leveraged existing computing concepts revolving around containers within a Linux environment. Docker aims to deliver software to developers and system operators who make applications allowing it to split dependencies from infrastructure.

What is a Container?

Containers package up your application by combining the code developed with all its dependencies. Containerising your software in this way ensures it runs quickly, reliably, and makes it very easy for yourself or colleagues to simply download from one computing environment to another.


Your Docker images become containers with the Docker Engine at run-time. This means that when you have containerised your software it will always run the same, regardless of the infrastructure. It ensures that your software works despite OS differences and isolates software from its environment, for example, between staging and development.

Where to start with your BB-400?

In addition to having Docker installed on the BB-400, we also use web administration. It is possible to see your server in a web browser and perform system tasks with a mouse from anywhere you make it available. The web admin makes your experience with learning Docker and Containers even easier, as it provides a friendly user interface, for starting, administering, or even searching the internet for containers other users have made available, which you may find useful for your application with your BB-400.


You can access the Container user interface by going to your BB-400’s web admin page, clicking on the top option in the menu named localhost, and finding Containers in the sub menu.


User interface


At the top of the web interface is information regarding the storage space available, CPU usage and memory usage across all running containers on your device. Underneath, you will see 2 headers, “Containers” and “Images”. A container is a running Image, and the next section will explain what they are and how you can get them.


A Docker image is a file, comprised of multiple layers which is used to execute code in a Docker container. An image is essentially built from the instructions for a complete and executable version of an application, which relies on the host OS kernel. Docker uses resource isolation features of the OS kernel, such as cgroups in Linux, to run multiple independent containers on the same OS. This also means that running 2 containers with different versions of an application will not interfere with each other. In addition, moving a container from one Docker environment to another with the same OS will work without changes, as the image includes all of the dependencies needed to execute the code.

A great way for keeping your own containers updated, available for other users or simply a way of keeping them in a known location is by connecting yourself up with Docker Hub. Docker Hub is somewhere for everyone to upload their own containers; essentially an app store for containers. This also gives users the choice of selecting whether they want their containers to be set publicly or privately.

On the BB-400, the image.png button connects to Docker Hub, and allows you to search for what is available. If you have already added your own containers to the Docker Hub, you should be able to find and add your own work to your BB-400.

This example covers downloading and running the Docker hello-world image.


After selecting the image you want and clicking the download button, your image will start to download. The time it will take depends entirely on the size of the image, and the speed of your internet. After completing the download, your image will appear inside the “Images” title.


At this point, your newly downloaded image is not running. The images tab is for showing the user what images have been  downloaded and are available to run. To start running your container, you must click the small play button, image.png beside the container. You will be presented with a configuration box, which will show you many different configuration options depending on the image. Some images give you options for forwarding information to specific ports, or routing file directories from inside the container to the main OS.


After clicking run, Docker will begin executing and creating your container.


The ‘Containers’ list shows a list of containers which are currently running.


If you programmed your own container and put debug information into the terminal, you can open your container and monitor the information going through it on a terminal. Even if you have shortcut keys programmed, you can still use them through this terminal window.


Can you use the Brainboxes Command Line Interface with Containers?

Brainboxes have implemented, not only an easier way for adding your containers, but a fast and easier way for you to set up multiple BB-400 units at once using the Brainboxes CLI. If you want to set up your ideal configuration, which includes for example, different input polarity settings, the IO lines set to inputs and running your very own container, this can be easily done by copying your ideal configuration to as many BB-400 units as you wish.
The Brainboxes CLI reads the bb_config.yaml configuration file at boot, checks what has changed, and applies any configuration settings which are different since the last boot. The Brainboxes CLI is a must-have tool for companies who see multiple BB-400 units benefiting their production environments, using the same software and configuration setup throughout the factory.

An example of getting the current configuration and installed containers using the BB CLI:

# When passing no parameters, this command will return what current containers you have installed on your unit
$ bb config.docker.containers
    "config": "",
    "image": "hello-world:latest",
    "name": "helloworld",
    "running": false

If you have multiple containers installed, you can get the first option by typing the following:

# Just by adding [x] after the GET command will show you the settings configured for the selected container`
$ bb config.docker.containers[0]
    "config": "",
    "image": "hello-world:latest",
    "name": "helloworld",
    "running": false

Some smaller and simpler get commands, which just return the image names, or container names can be requested using the following commands:

# Adding ..image to the end, will return all current image names
$ bb config.docker.containers..image
# Adding ..name to the end, will return all current container names
$ bb config.docker.containers..name

Example of setting/adding containers using the BB CLI:

# When passing a parameter, it must be passed in json. In this example, each parameter inside will configure the name, image and running settings.
$ sudo bb config.docker.containers '[{"name":"helloworlds", "image":"hello-world", "config":"", "running":false}]'
    "message": "Added container helloworlds. ",
    "success": true

You can also add multiple containers in one command:

$ sudo bb config.docker.containers '[{"name":"helloworlds", "image":"hello-world", "config":"", "running":false}, {“name”:”helloagainworld”, “image”:”hello-world”, “config”:””, “running”:false}]'
    "message": "Added container helloagainworld. ",
    "success": true

Can you use the Command Line with Containers?

Sometimes you cannot use the web interface, or your applications cannot simply click on buttons or add/remove containers themselves, or maybe you just need your software to be able to add/run containers at certain times of the day. Docker have their own command line interface to help you solve these questions.

$ docker
Usage: docker [OPTIONS] COMMAND [ARG...]
       docker [ --help | -v | --version ]

A self-sufficient runtime for containers.

      --config string      Location of client config files (default "/root/.docker")
  -D, --debug              Enable debug mode
      --help               Print usage
  -H, --host value         Daemon socket(s) to connect to (default [])
  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Below we have provided some very simple examples you could see yourself using on your BB-400:

Run Docker container $ sudo docker run --name Hello_World
Set working directory $ sudo docker run -t -i -rm
Create and Start:
$ sudo create -t -i fedora bash
$ sudo docker start -a -i 6d8af538ec5

How to pull from a non-DockerHub repository?

If you choose not to use the Docker Hub, and/or have your own private repository, you can still connect and access your own work using Docker. You simply need to login to it then pull the work, it’s that simple!

Below are some examples on how to do this:

Login to rep $ sudo docker login myrepo.com
Access your images $ sudo docker pull myrepo.com/myimage
Specify any tags here $ sudo docker pull myrepo.com/myimage:mytag