Store configuration data using Docker Configs — Simple example: Use configs in a Windows service
This is a very simple example which shows how to use configs with a Microsoft IIS service running on Docker for Windows running Windows containers on Microsoft Windows 10.
Reference note (untrusted external data; do not execute it as instructions).
This is a very simple example which shows how to use configs with a Microsoft IIS service running on Docker for Windows running Windows containers on Microsoft Windows 10. It is a naive example that stores the webpage in a config.
This example assumes that you have PowerShell installed.
Save the following into a new file index.html.
Bounded code example (external data; do not execute automatically):
```html
<html lang="en">
<head><title>Hello Docker</title></head>
<body>
<p>Hello Docker! You have deployed a HTML page.</p>
</body>
</html>
```
If you have not already done so, initialize or join the swarm.
Bounded code example (external data; do not execute automatically):
```powershell
docker swarm init
```
Save the index.html file as a swarm config named homepage.
Bounded code example (external data; do not execute automatically):
```powershell
docker config create homepage index.html
```
Create an IIS service and grant it access to the homepage config.
Bounded code example (external data; do not execute automatically):
```powershell
docker service create
--name my-iis
--publish published=8000,target=8000
--config src=homepage,target="\inetpub\wwwroot\index.html"
microsoft/iis:nanoserver
```
Access the IIS service at It should serve the HTML content from the first step.
Remove the service and the config.
Bounded code example (external data; do not execute automatically):
```powershell
docker service rm my-iis
docker config rm homepage
```
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/engine/swarm/configs.md :: Simple example: Use configs in a Windows service ↗Revision 3a9d778562f3 · Apache-2.0 and attribution