Comprehensive Guide for Configuring a Docker Container with Dropdown Selection for WireGuard VPN Configurations in Unraid
Overview
This guide provides detailed instructions for setting up a Docker container in Unraid, allowing users to select WireGuard VPN configurations through a dropdown menu. This setup enhances user experience by simplifying the selection of VPN options.
Step-by-Step Instructions
1. Access the Docker Template Editor
- Open the Unraid web interface.
- Navigate to the Docker tab.
- Select the container you wish to edit (e.g.,
binhex-qbittorrentvpn). - Click on the Edit button.
2. Add a Custom Variable with Dropdown Menu
-
Scroll down to the section titled Add another Path, Port, Variable, Label or Device.
-
Choose Variable from the dropdown menu.
-
Complete the fields as follows:
- Key:
WG_PATH - Value:
/mnt/user/appdata/[your-container-name]/[vpn1_wg](set an initial default value) - Description:
Select WireGuard configuration path
- Key:
-
Click on Advanced View in the upper right corner to access advanced settings.
-
In the Variable section, locate the “Value” field and replace it with the following entries (make adjustments as necessary for paths and labels):
/config/wg|/mnt/user/appdata/[your-container-name]/vpn1_wg|VPN 1 WireGuard /config/wg|/mnt/user/appdata/[your-container-name]/vpn2_wg|VPN 2 WireGuard
3. Modify Path Mapping
- Scroll to the Path section of the Docker container configuration.
- Locate the path mapping for
/config/wg, or create a new path if it is not already present. - Set the following:
- Container Path:
/config/wg - Host Path:
$WG_PATH
- Container Path:
4. Save and Apply Changes
- After configuring the variable and path mapping, click on Apply to save your changes.
5. Test the Dropdown Functionality
- Restart the Docker container.
- Return to the Docker container settings.
- You should now see a dropdown menu for the
WG_PATHvariable. Select a different option and apply the changes. - Verify that the container correctly maps the
/config/wgpath to the selected host path.
Example of Final Template Configuration
-
Variable Configuration:
- Key:
WG_PATH - Value:
/mnt/user/appdata/[your-container-name]/vpn1_wg - Description:
Select WireGuard configuration path - Dropdown Values:
/config/wg|/mnt/user/appdata/[your-container-name]/vpn1_wg|VPN 1 WireGuard /config/wg|/mnt/user/appdata/[your-container-name]/vpn2_wg|VPN 2 WireGuard
- Key:
-
Path Configuration:
- Container Path:
/config/wg - Host Path:
$WG_PATH
- Container Path:
Condensed XML for Unraid Template
<Container>
<Name>binhex-qbittorrentvpn</Name>
<Description>qBittorrent VPN container with WireGuard support</Description>
<Config Name="VPN Selector" Target="WG_PATH" Default="/mnt/user/appdata/binhex-qbittorrentvpn/vpn1_wg" Mode="rw" Description="Select WireGuard configuration path" Type="Variable" Display="always" Required="true" Mask="false">
<Dropdown>
<Item>
<Value>/mnt/user/appdata/binhex-qbittorrentvpn/vpn1_wg</Value>
<Label>VPN 1 WireGuard</Label>
</Item>
<Item>
<Value>/mnt/user/appdata/binhex-qbittorrentvpn/vpn2_wg</Value>
<Label>VPN 2 WireGuard</Label>
</Item>
</Dropdown>
</Config>
<Config Name="WireGuard Config Path" Target="/config/wg" Default="$WG_PATH" Mode="rw" Description="Container path for WireGuard config" Type="Path" Display="always" Required="true" Mask="false" />
</Container>
Conclusion
By following these instructions, you will successfully configure your Docker container in Unraid with an intuitive dropdown menu for selecting WireGuard VPN configurations. This setup not only streamlines management but also enhances flexibility in your network configurations.