Gwcmd, start, stop in Docker container


What would be the best way to restart an instance of Ignition in a Docker container? Since the mount point is at Ignition/data, gwcmd, start, and stop aren’t available within the container. Is my best alternative a Docker restart?


Hi @ken.maze

I have been using @Kevin.Collins docker image and I am tagging him here since he might be able to chime in better than I.

Anyways, what I do to restart the docker gateway is to go and restart the docker instance itself. I actually “cheat” and installed portainer a while ago and just click the restart button on my Ignition docker container. I do make sure that we all have saved before I restart it though in case there are any problems.

One summary statement I’ll throw in here at the beginning is that you can think of containers as just some extra wrappings around what are really Linux processes under the hood. Normally, when you stop a process, you’re doing so from the context of a host system–the process terminates and you continue on with your day. The same is true for containers; you just have to consider the context from which you’re performing those lifecycle operations.

So, that said, you can issue a gwcmd -r restart from within the container (for both inductiveautomation/ignition (as of 8.1.4) and kcollins/ignition (all) images) without issue. This keeps the container running because the java wrapper stays running. Doing an ./ stop within the container is different because it stops the gateway and wrapper altogether. Since containers are just Linux processes, that means that you’ve stopped the container. Now the context you used to stop the container is no longer running either–the only thing to do to start it back up is to use the container runtime (e.g. docker start <container name>) to do so. So ./ stop does work, but using that technique to stop the container is a bit strange. In the case of ./ start, it doesn’t apply at all.

I generally agree with @jimender2 in that if you are running Ignition in containers, it is probably reasonable to just use the lifecycle operations there to manage the start/stop/restart. When you issue a stop (e.g. docker stop <container name>), the gateway receives that signal and performs a clean shutdown in the same way you’d see with the Ignition CLI tools.


Are you saying I could use docker container exec to open a command line, then issue the gwcmd from there?

Sorry, still a bit new at Docker, but sucking it all up like a sponge!

Yes, docker exec is your friend! See a demo of some various Docker CLI invocations (with an Ignition-centric focus of course!) via the link below:

Hopefully you find some helpful tips in there…

1 Like

./ -p is bash command that I was looking for. Thanks.