# Docker Gateway Restore with Compose

**URL:** <https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [September 13, 2021, 7:23pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919 "2021-09-13T19:23:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 13, 2021, 7:23pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/1 "2021-09-13T19:23:18Z")

</div>

I am trying to setup a gateway to automatically restore from a backup in startup, following the documentation, and there is a command line argument mentioned (`-r`) that I am unable to find in even [Dockers documentation](https://docs.docker.com/engine/reference/run/)!

Does anyone potentially know what that argument is? So that I can use it in a docker-compose file, because without it the restore doesn’t seem to happen. It says “runtime argument”, but I am not sure if its the same thing as `--runtime` or just a poor wording coincidence.

> **Documentation Section**
>
> **Automating the Restore of a Gateway Backup**  
> The following feature is new in Ignition version **8.1.7**  
> [Click here](https://docs.inductiveautomation.com/display/DOC81/New+in+this+Version#NewinthisVersion-Newin8.1.7) to check out the other new features
> 
> You can automate the restore of a gateway backup on first-launch of your gateway container. This allows for having a new Ignition Gateway restore to a known initial state automatically, without waiting for the commissioning steps.
> 
> To leverage this feature, bind-mount a gateway backup into the container and then use the `-r` runtime argument to specify the location and command the restore. Additionally, supply the `ACCEPT_IGNITION_EULA=Y` environment variable to accept the Ignition EULA (see the [Licensing](https://docs.inductiveautomation.com/display/DOC81/Docker+Image#DockerImage-Licensing)section below) and bypass that gateway commissioning step.
> 
> ```auto
> docker run -d -p 9088:8088 --name ignition- test \
> - v gw-data:/usr/local/bin/ignition/data \
> - v /path/to/gateway.gwbk:/restore.gwbk \
> -e ACCEPT_IGNITION_EULA=Y \
> inductiveautomation/ignition:8.1.7 \
> -n docker-test -a localhost -h 9088 -s 9043 \
> -r /restore.gwbk
> 
> ```

---

<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:** [September 13, 2021, 7:54pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/2 "2021-09-13T19:54:28Z")

</div>

Everything after the image reference in a `docker run` is sent to the container as command-line arguments. So it is our entrypoint script that is consuming arguments such as `-r /path/to/gateway.gwbk`.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 13, 2021, 7:56pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/3 "2021-09-13T19:56:33Z")

</div>

Ahhh, that makes sense.

Then my new question becomes, how can I pass that command line argument to the entrypoint in a compose?

Here is my current yaml:

```auto
version: "3"

services:  
  example_gateway:
    image: inductiveautomation/ignition
    ports:
    - "8088"
    env_file:
    - 'variables.env'
    volumes:
    - ./ignition_gateway.gwbk:/restore.gwbk

```

As of right now it doesn’t seem to be doing the restore

---

<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:** [September 13, 2021, 8:00pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/4 "2021-09-13T20:00:09Z")

</div>

Use the following format:

```auto
services:
  gateway:
    ...
    command: >
      -n Ignition-gateway-name
      -r /path/to/restore.gwk

```

The above makes use of [YAML Block Styles](https://yaml.org/spec/1.2.1/#Block), the above condenses to `-n ... -r ...` all on one line, but offers the convenience of multi-line representation in the YAML file for easy viewing/editing.

EDIT: [This example ​in our documentation](https://docs.inductiveautomation.com/display/DOC81/Docker+Image#DockerImage-UsingDockerCompose) also shows this technique, combined with the supplying of JVM/Wrapper/Gateway args after the double-hyphen

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 13, 2021, 8:06pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/5 "2021-09-13T20:06:08Z")

</div>

So does the `/path/to/restore.gwbk` need to be defined in the volumes **and** in the command argument? And is Gateway name required?

(It may be useful to try and explain this a little more in the doc page, its not entirely clear from a user perspective that the `-r` argument is a command and not like the other tags. Potentially just adding it into the example you mentioned may help?)

EDIT: I shortly realized that the `/path/to/restore.gwbk` is the path once INSIDE the container, not the path outside the container. So I definitely see why it should be defined both times.

---

<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:** [September 13, 2021, 8:10pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/6 "2021-09-13T20:10:55Z")

</div>

> [@kgamble](#):
>
> So does the `/path/to/restore.gwbk` need to be defined in the volumes **and** in the command argument? And is Gateway name required?

The path that you point to with the `-r <path to gwbk file>` runtime argument does need to exist within the container filesystem. This might be something you bind-mount in via a _volume_ declaration, or it might be something you bake in via a derived image of your own.

I _think_ that the section on [runtime arguments](https://docs.inductiveautomation.com/display/DOC81/Docker+Image#DockerImage-RuntimeArguments) in the docs does mention where these options/flags should be supplied. All of those are optional.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 13, 2021, 8:13pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/7 "2021-09-13T20:13:46Z")

</div>

> [@kcollins](#):
>
> I _think_ that the section on [runtime arguments](https://docs.inductiveautomation.com/display/DOC81/Docker+Image#DockerImage-RuntimeArguments) in the docs does mention where these options/flags should be supplied. All of those are optional.

You are definitely right, I just didn't tie those two sections together in my brain!

As always, I appreciate the clarification Kevin.

For completeness sake, here is the above mentioned compose with the updated content:

```auto
version: "3"

services:
  example_gateway:
    image: inductiveautomation/ignition:latest
    ports:
    - "8088"
    env_file:
    - 'variables.env'
    volumes:
    - ./ignition_client_gateway.gwbk:/restore.gwbk
    command: >
      -n example_gateway_name
      -r /restore.gwbk

```

---

<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:** [September 13, 2021, 8:15pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/8 "2021-09-13T20:15:18Z")

</div>

You’re welcome! Don’t forget to use explicit image tags in your `image:` declarations! While we provide `latest` tags, I definitely don’t recommend their use in most cases, as it rarely guarantees that you’re using the _latest_, rather that you’re only using the last `latest` that you pulled. 😆

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 16, 2024, 8:44am UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/9 "2024-01-16T08:44:57Z")

</div>

I love the explanation you gave here, but one thing that's not really clear to me is the other volume mounted to the container: `- ./ignition_client_gateway.gwbk:/restore.gwbk` is it the path to where the ignition volume is stored or I'll first run backup, store it in a file and use the file path as the /restore.gwbk

I don't know maybe you understand me

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [January 16, 2024, 2:06pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/10 "2024-01-16T14:06:24Z")

</div>

If you would like to restore a backup on initial creation, than it’s the path to that backup on the docker host

The /restore.gwbk is just the name we picked and gave the -r argument

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 16, 2024, 2:09pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/11 "2024-01-16T14:09:30Z")

</div>

Then is this correct?

```auto
services:
 ignition:
   image: inductiveautomation/ignition:latest
   ports:
     - 9088:8088
     - 9060:8060
   volumes:
     - gw-data:/usr/local/bin/ignition/data
     - /var/lib/docker/volumes/ignition_gw-data/_data:/restore.gwbk
   environment:
     - ACCEPT_IGNITION_EULA=Y
     - IGNITION_NETWORK_INTERFACE=docker
     - IGNITION_GATEWAY_ADDRESS=localhost
     - IGNITION_GATEWAY_PORT=9088
     - IGNITION_GATEWAY_SECURE_PORT=9043
   command: >
     - n ignition_gateway
     - r /restore.gwbk

```

---

<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:** [January 16, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/12 "2024-01-16T15:22:30Z")

</div>

> [@Ifeoluwashola\_Adaral](#):
>
> ` - /var/lib/docker/volumes/ignition_gw-data/_data:/restore.gwbk`

No, this is incorrect. The left side of the volume configuration should contain an absolute or relative path to a gateway backup file on the host. The right side (after the `:`) is then where you want to bind-mount that _inside the container_.

You might find some inspiration from these examples that I've created as well: [GitHub - thirdgen88/ignition-examples: Ignition Examples with Docker Compose](https://github.com/thirdgen88/ignition-examples).

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 17, 2024, 12:19pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/13 "2024-01-17T12:19:55Z")

</div>

Thank you, I've seen the examples, but I still don't seem to understand it fully, the `.gwbk` file, does it get created automatically or I'm missing the step of creating it. I think my issue now is how to get the `base.gwbk` file or anything I want to call the name.

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 17, 2024, 2:37pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/14 "2024-01-17T14:37:31Z")

</div>

Do I have to first manually download the backup from the gateway webpage?

---

<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:** [January 17, 2024, 2:38pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/15 "2024-01-17T14:38:23Z")

</div>

Ahhh, yes, those examples reference an already-existing GWBK that you're mounting into the container to restore on the first launch. You don't need that if you're just wanting to start up an Ignition container in its default initial state.

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 17, 2024, 2:44pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/16 "2024-01-17T14:44:05Z")

</div>

Now, I have a gateway which I deployed using compose file, I have some projects on the gateway and I want to restore all my project on another gateway, can I achieve this without having to manually download the backup file on the webpage? Just curious.  
And one more thing is how to manage the license key during the process. Thank you

---

<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:** [January 17, 2024, 2:52pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/17 "2024-01-17T14:52:09Z")

</div>

> [@Ifeoluwashola\_Adaral](#):
>
> Now, I have a gateway which I deployed using compose file, I have some projects on the gateway and I want to restore all my project on another gateway, can I achieve this without having to manually download the backup file on the webpage?

You can [bind-mount](https://docs.docker.com/storage/bind-mounts/) a path from your host into the container and target that container path in a [Scheduled Backups](https://docs.inductiveautomation.com/display/DOC81/Gateway+Settings#GatewaySettings-ScheduledBackups) configuration.

> [@Ifeoluwashola\_Adaral](#):
>
> And one more thing is how to manage the license key during the process.

The gateway backup file will not contain any information about licensing. If you're using containers, you should probably be using [Leased Activation](https://docs.inductiveautomation.com/display/DOC81/Licensing+and+Activation#LicensingandActivation-LeasedLicenses(Eight-characterkeys)) licensing with an 8-digit license key.

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 17, 2024, 3:27pm UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/18 "2024-01-17T15:27:05Z")

</div>

Let's say I bind-mount this path:  
`volumes: - type: bind source: ./static target: /opt/app/static volumes: myapp:`

Then in my scheduled backup I'll target `/opt/app/static` as my backup folder, right?

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 18, 2024, 9:14am UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/19 "2024-01-18T09:14:16Z")

</div>

Look at what I have now

```auto
version: '3.7'
services:
 ignition:
   image: inductiveautomation/ignition:latest
   ports:
     - 9088:8088
     - 9060:8060
   volumes:
     - gw-data:/usr/local/bin/ignition/data
     - C:\Users\USER\Downloads\Ignition-d967586f6d3a_Ignition-backup-20240118-0900.gwbk:/restore.gwbk
   environment:
     - ACCEPT_IGNITION_EULA=Y
     - IGNITION_NETWORK_INTERFACE=docker
     - IGNITION_GATEWAY_ADDRESS=localhost
     - IGNITION_GATEWAY_PORT=9088
     - IGNITION_GATEWAY_SECURE_PORT=9043
     - IGNITION_EDITION=standard
     - GATEWAY_ADMIN_USERNAME=admin
     - GATEWAY_ADMIN_PASSWORD=password1
   command: >
     -n ignition_gateway
     -h 9088
     -s 9043
     -a localhost
     -r /restore.gwbk
   logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"
   restart: always
volumes: 
  gw-data:

```

I downloaded the backup file and mount the path to the container and used the `runtime -r` flag

---

<div class="post-metadata">

**Author:** ![Ifeoluwashola\_Adaral](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@Ifeoluwashola\_Adaral](https://forum.inductiveautomation.com/u/Ifeoluwashola_Adaral)\
**Post date:** [January 29, 2024, 11:18am UTC](https://forum.inductiveautomation.com/t/docker-gateway-restore-with-compose/50919/20 "2024-01-29T11:18:18Z")

</div>

Just in case you can also assist with this. I set scheduled backup but I'm getting permission denied error.

 ![Screenshot (89)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/8/68a9938d2c8e8499f58957ee1dd8c61928e895e6.png)
