README.md

mozilla-iot-gateway-container

This provides the container description for the mozilla-iot-gateway

Requires

The following needs to be installed on your development system: - podman

Creation of image

To create the mozilla-iot-gateway-container image use

podman build -f Dockerfile -t mozilla-iot-gateway .

In order for this to work you have to be in the directory of the dockerfile.

Run image

for testing purposes

To allow mounting of a directory from an running container we have to set the selinux permission in such a way that this is allowed. This is done using the following command

chcon -Rt svirt_sandbox_file_t /mozilla-iot

With this command we can mount the folder /mozilla-iot in the container. If we don't do this we get a persmission denied error.

Use the following command to run the image for testing purposes:

podman run --rm -it mozilla-iot-gateway /bin/bash
podman run --rm -it -p 8080:8080 -v /mozilla-iot:/root/.mozilla-iot/:rw mozilla-iot-gateway /bin/bash

To test if everything works open your browser of choice and go to the URL: http:localhost:8080. Note that the path to the volume needs to provides in an absolute way, both inside and outside of the container.

Run image for production

Use the following command to run the image and access the gateway from outside

podman run -d -p 8080:8080 mozilla-iot-gateway

This will provide you with an container <ID> which you can use with the following command to attach to the container

podman exec -t -i <ID> /bin/bash

To assign a name to the running container just modify the above command to

podman run -d -p 8080:8080 -v /mozilla-iot:/root/.mozilla-iot/:rw --name m-iot-gw1 mozilla-iot-gateway

Microdnf approach for smaller container images

For more information see: https://fedoramagazine.org/building-smaller-container-images/

The image can be build using

podman build -f DockerfileMicroDnf  -t mozilla-iot-gateway-micro .

and run using

podman run -d --rm -p 8080:8080 -v /mozilla-iot:/root/.mozilla-iot/:rw --name m-iot-gw-micro mozilla-iot-gateway-micro