Ignition under Docker Usage Examples

As some folks know, I’ve been working to make Ignition work nicely under Docker for some time through my efforts at ignition-docker on GitHub. I think there is a great use case here for those doing Ignition development. I’ve recently made some additional updates to the kcollins/ignition Docker Image and most recently created a repository of Docker Compose example implementations. These can be helpful for quickly and easily pairing a database with your Ignition gateway to do development! I wanted to share this initial effort to help get folks going with Ignition and Docker.

I hope to continue this effort and create some additional guides and tutorial media/materials in the future as well. Let me know what you think! Pull requests welcome, and feel free to create a GitHub issue there too if you have trouble getting things working.

8 Likes

Just wanted to say thank you for this. We’ve been using your images on dockerhub for a while and they’ve been a great help!

We too started using docker for Ignition development recently, and it works like a charm.

It’s a lot faster to set up a new installation compared to virtual machines, there’s a lot you can automate (f.e. automatically copying backups), and it’s a lot lighter on resources than virtual machines.

Though I’m still looking for ways to make it more accessible for my colleagues with less Linux/CLI experience. For the moment, I’m using Portainer as GUI for docker, so they can start, stop and add containers. But defining volumes in Portainer is quite cumbersome, and you really need named volumes for a project that takes some months to develop.

Big fan of Portainer too… I will try to share some of the templates for that that I setup to enable quick one-click[ish] creation of Ignition containers through Portainer. It is a nice GUI front end for Docker, and is improving all the time…

2 Likes

Does Inductive consider Ignition running under docker supported?

Basically yes, as per some licensing changes we made in the 7.9 branch. You’re pretty much on your own as far as configuration, though there are plans for better support - possibly in 8.1, but we’re still exploring our options.

1 Like

@Kevin.Collins are you planning on getting 8.0.0 GA added to your docker? #AskingForAFriend :wink:

Yes, I’m working on it! I’m working through some recent changes regarding Ignition Edge no longer being in the main installer (which I was using for the Dockerfiles). I’m moving over to just using the zip package so that way it will be the same between Edge and Standard.

Stay tuned! I will let folks know here when I’ve updated things.

Ignition 8.0.0 Docker Image released! :grinning:

I’ve yet to update the examples repo (that is the subject of this post) with the new kcollins/ignition:8.0.0 tags, I’ll get there at some point here.

4 Likes

I was hoping this was already out! Thanks a bunch for your hard work!

You are welcome! I just pushed a new image after discovering a small bug with how I was trying to reduce the image size (by extracting and then purging the archived JRE runtime files). The Designer Launcher in 8.0.0 will download the JRE bundle (for the appropriate platform) from the gateway. Please do another docker image pull to get the latest and avoid the “503 Runtime does not exist” error.

1 Like

Hi!
First off, big Thanks for the awesome work getting this container available to the community!

I can’t seem to be able to set the environment variables when I deploy the container. I am using portainer to manage my docker environment(s) and at some point I was able to specify the different ENV variables, but not anymore.

When the image deploys, none of those settings seem to be applied. ie: gateway.xml contains this:

Any ideas?

Thanks!

I just tried this on the command line with the docker run below:

$ docker run -p 8089:8089 -p 8044:8044 -v variable_test:/var/lib/ignition/data -e GATEWAY_ADMIN_PASSWORD=password -e GATEWAY_HTTP_PORT=8089 -e GATEWAY_HTTPS_PORT=8044 -e GATEWAY_INIT_MEMORY=1536 -e GATEWAY_MAX_MEMORY=1792 kcollins/ignition:8.0.2

It came up as expected on the alternate ports, and the data/gateway.xml showed the adjusted keys for the HTTP and HTTPS port. Additionally, the gateway memory values were successfully put into effect.

Here are a couple things of note:

  • The GATEWAY_HTTP_PORT and GATEWAY_HTTPS_PORT (as well as the gateway network) environment variables will only take effect on a new container [against a new volume, if applicable]. With the command above, you should see lines like these at the beginning of the log (after which the data/gateway.xml file will be configured correctly):
Provisioning will be logged here: /usr/local/share/ignition/logs/provisioning.log
Waiting for commissioning servlet to become active...
Performing commissioning actions...
  GATEWAY_ADMIN_USERNAME: admin
  GATEWAY_HTTP_PORT: 8089
  GATEWAY_HTTPS_PORT: 8044
Shutting down interim provisioning gateway...
Starting Ignition Gateway...
  • The GATEWAY_INIT_MEMORY and GATEWAY_MAX_MEMORY environment variables are appended to the launch command and will override any values in the ignition.conf file, FYI.

Let me know if any of these insights are of help—I’d definitely like to help you get through any issues you’re having! At some point I had considered creating a Portainer example with built-in Ignition templates. It sounds like that might be a useful thing.

Thanks for the feedback!

Thanks Kevin!
Interesting; I do see my override ENV variables in the log, but the data/gateway.xml still shows port 8080.
I noticed the other day that when you first install ignition (not docker image), it will not let you assign a port below 1024; I was trying to use port 80, maybe that’s the reason?
Good call on the *MEMORY ENV variables, I did notice that but the Gateway status page was showing my docker startup settings correctly.

Ports below 1024 can’t be allocated by a non-superuser. The docker container runs as ignition with UID 999. You’d have to run the container as root if you really want to allocate ports between 1-1023.

2 Likes

Could you please post a Portainer example? I’ve been using docker containers on various stand alone machines, but now I’m trying to move to a docker swarm and added Portainer as well. However, I can’t get a container nor a service to run 8.0.2 successfully.

Just setup Docker&Portainer on headless Debain stretch this week, great work, thanks!

I have been unsuccessfully attempting to get ignition running in docker for a couple days now and continue to have the same error preventing my container from starting.
I have the following error…

/usr/local/bin/docker-entrypoint.sh: line 364: /usr/local/share/ignition/data/.docker-init-complete: Permission denied

I am using the following to start my container.

docker run --name my-ignition \
-v ~/docker/ignition/ignition.conf:/var/lib/ignition/data/ignition.conf \
-v ~/docker/ignition/data:/var/lib/ignition/data \
-p 8088:8088 \
-e GATEWAY_ADMIN_PASSWORD=password \
-d kcollins/ignition

@philc, welcome to the forums! Thanks for reaching out. I want to point you toward this GitHub issue for some relevant conversation:

Long story short, I think you need to use a named volume for your /var/li/ignition/data volume, otherwise you’re likely to have to deal with a bunch of permissions issues against your local filesystem.

So it might look like this:

# Change to your target directory
cd ~/docker/ignition
# Create the volume
docker volume create my-ignition-data
# Copy the base ignition.conf if you don't have it already
docker run --rm -v ${PWD}:/output kcollins/ignition:latest \
  cp /var/lib/ignition/data/ignition.conf /output/
# Use a bind-mount for the custom ignition.conf, but a named volume for everything else
docker run --name my-ignition \
  -v ~/docker/ignition/ignition.conf:/var/lib/ignition/data/ignition.conf \
  -v my-ignition-data:/var/lib/ignition/data \
  -p 8088:8088
  -e GATEWAY_ADMIN_PASSWORD=password \
  -d kcollins/ignition:latest

Hopefully this will get you cooking!

Thank you! That got me going. Appreciate the assistance.