# Gwcmd, start, stop in Docker container

**URL:** <https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250>\
**Category:** Ignition\
**Created:** [May 29, 2021, 5:23am UTC](https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250 "2021-05-29T05:23:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [May 29, 2021, 5:23am UTC](https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250/1 "2021-05-29T05:23:27Z")

</div>

Hi,

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?

Thanks

---

<div class="post-metadata">

**Author:** ![jimender2](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@jimender2](https://forum.inductiveautomation.com/u/jimender2)\
**Post date:** [June 1, 2021, 11:02am UTC](https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250/2 "2021-06-01T11:02:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [June 1, 2021, 2:35pm UTC](https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250/3 "2021-06-01T14:35:49Z")

</div>

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 `./ignition.sh 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 `./ignition.sh stop` _does work_, but using that technique to stop the container is a bit strange. In the case of `./ignition.sh 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.

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [June 1, 2021, 5:35pm UTC](https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250/4 "2021-06-01T17:35:18Z")

</div>

Are you saying I could use [docker container exec](https://docs.docker.com/engine/reference/commandline/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!

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [June 1, 2021, 6:16pm UTC](https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250/5 "2021-06-01T18:16:55Z")

</div>

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:

[https://asciinema.org/a/30ffcPUQ5sVNacUrvuEgbYbbt](https://asciinema.org/a/30ffcPUQ5sVNacUrvuEgbYbbt)

Hopefully you find some helpful tips in there…

---

<div class="post-metadata">

**Author:** ![petr.sasin](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@petr.sasin](https://forum.inductiveautomation.com/u/petr.sasin)\
**Post date:** [August 23, 2023, 9:26am UTC](https://forum.inductiveautomation.com/t/gwcmd-start-stop-in-docker-container/47250/6 "2023-08-23T09:26:33Z")

</div>

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