How to fix Error response from daemon: config not found: myconfig in Docker

DockerBEGINNERMEDIUMUpdated Dec 6, 2025ยท 118 views

This error occurs when a Docker Swarm service references a config that doesn't exist in the swarm. Configs must be created before deploying services that use them. The fix involves creating the missing config or updating your service definition.

Quick fix

Fixes Error response from daemon: config not found: myconfig

docker config ls
  1. Verify the config exists
  2. Create the missing config
  3. Ensure swarm mode is active
  4. Fix external config references in docker-compose
docker โ€” error
docker config ls
Error response from daemon: config not found: myconfig

What this error means

The "config not found" error occurs when Docker Swarm tries to deploy or update a service that references a config object that hasn't been created in the swarm. Docker configs are a swarm-mode feature that allows you to store non-sensitive configuration data (like config files) outside of service images. Unlike secrets (which are encrypted at rest), configs are stored unencrypted and mounted directly into containers. They're useful for storing configuration files, environment-specific settings, or any data up to 500KB that your services need. This error commonly happens when: - You deploy a stack or service that references a config before creating it - The config was deleted but services still reference it - There's a typo in the config name in your docker-compose.yml or service definition - You're trying to use configs outside of swarm mode (configs only work with swarm services) - The stack file references an external config that was never created Docker configs are only available to swarm services, not standalone containers. If you're not running in swarm mode, you'll need to initialize a swarm first or use a different approach like bind mounts or environment variables.

Typical symptoms

  • docker stack deploy fails with 'config not found: <config_name>'
  • docker service create fails when referencing a non-existent config
  • docker service update fails when adding a config that doesn't exist
  • Service tasks stay in 'pending' state with config-related errors
  • Error appears immediately after running docker stack deploy
  • Services that previously worked fail after swarm re-initialization

Common causes

  1. The config was never created before deploying the service or stack
  2. The config name in the service definition doesn't match the actual config name
  3. The config was deleted while services still reference it
  4. Using 'external: true' for a config that doesn't exist yet
  5. Attempting to use configs outside of Docker Swarm mode
  6. Config names are case-sensitive and there's a casing mismatch

How to fix "Error response from daemon: config not found: myconfig"

1Verify the config exists

First, check if the config actually exists in the swarm:

bash
docker config ls

Look for your config name in the output. You can also filter by name:

bash
docker config ls --filter name=myconfig

If the config isn't listed, you need to create it before deploying your service.

2Create the missing config

Create the config from a file:

bash
docker config create myconfig ./config-file.conf

Or create from stdin:

bash
echo "config content here" | docker config create myconfig -

You can also create configs from existing files with specific content:

bash
# From a JSON config file
docker config create app_config ./app-config.json

# From an nginx config
docker config create nginx_conf ./nginx.conf

After creating the config, verify it exists:

bash
docker config ls
docker config inspect myconfig
3Ensure swarm mode is active

Docker configs only work in swarm mode. Check if your node is part of a swarm:

bash
docker info | grep Swarm

If it shows "Swarm: inactive", initialize a swarm:

bash
docker swarm init

On a multi-node setup, join worker nodes:

bash
# Get the join token on a manager
docker swarm join-token worker

# Run the provided command on worker nodes
docker swarm join --token <token> <manager-ip>:2377
4Fix external config references in docker-compose

When using docker-compose.yml (v3.3+) with stack deploy, configs can be defined as external or created by the stack.

Option 1: Create config first, then reference as external:

yaml
# docker-compose.yml
version: "3.8"
services:
  app:
    image: myapp
    configs:
      - myconfig

configs:
  myconfig:
    external: true

Create the config before deploying:

bash
docker config create myconfig ./config.json
docker stack deploy -c docker-compose.yml mystack

Option 2: Let the stack create the config from a file:

yaml
version: "3.8"
services:
  app:
    image: myapp
    configs:
      - source: myconfig
        target: /app/config.json

configs:
  myconfig:
    file: ./config.json
5Update or recreate the config

Docker configs are immutable - you cannot update them in place. To change a config's content, you must remove and recreate it:

bash
# First, update services to remove the config reference
docker service update --config-rm myconfig myservice

# Remove the old config
docker config rm myconfig

# Create the new config
docker config create myconfig ./new-config.conf

# Re-add the config to the service
docker service update --config-add myconfig myservice

For stack deployments, use a versioned naming convention:

yaml
configs:
  myconfig_v2:
    file: ./config.json

services:
  app:
    configs:
      - source: myconfig_v2
        target: /app/config.json
6Debug config access in services

If the config exists but services still fail, inspect the service to verify config attachment:

bash
docker service inspect myservice --pretty

Check the "Configs" section in the output. Verify:
- The config name matches exactly (case-sensitive)
- The target path is correct
- The config UID/GID and mode are appropriate

View service task errors:

bash
docker service ps myservice --no-trunc

Check container logs for config-related issues:

bash
docker service logs myservice

Advanced notes

Config mount location: By default, configs are mounted at /<config-name> in Linux containers. Specify a custom target path:

yaml
services:
  app:
    configs:
      - source: myconfig
        target: /etc/myapp/config.json
        uid: '103'
        gid: '103'
        mode: 0440

Config size limit: Configs can be up to 500KB in size. For larger configuration data, consider using bind mounts or storing configs in a shared volume.

Configs vs Secrets: Use configs for non-sensitive data (application configs, feature flags). Use secrets for sensitive data (passwords, API keys). Secrets are encrypted at rest and use tmpfs mounts.

Rotation strategy: Since configs are immutable, implement rotation using versioned names:

bash
docker config create myconfig_20240115 ./config.json
docker service update --config-rm myconfig_20240114 --config-add source=myconfig_20240115,target=/app/config.json myservice

Template configs: Docker 19.03+ supports config templating with Go templates:

yaml
configs:
  my_config:
    template_driver: golang
    file: ./config.tmpl

Troubleshooting replicas stuck pending: If service replicas stay pending after fixing the config, force a service update:

bash
docker service update --force myservice

Windows containers: Config file path must use the appropriate Windows path format when targeting Windows containers. Example: target: C:\\ProgramData\\app\\config.json

Frequently asked questions

What does "Error response from daemon: config not found: myconfig" mean?
The "config not found" error occurs when Docker Swarm tries to deploy or update a service that references a config object that hasn't been created in the swarm. Docker configs are a swarm-mode feature that allows you to store non-sensitive configuration data (like config files) outside of service images. Unlike secrets (which are encrypted at rest), configs are stored unencrypted and mounted directly into containers.
How do I fix "Error response from daemon: config not found: myconfig"?
This error occurs when a Docker Swarm service references a config that doesn't exist in the swarm. Configs must be created before deploying services that use them. The fix involves creating the missing config or updating your service definition.
What causes "Error response from daemon: config not found: myconfig"?
The config was never created before deploying the service or stack The config name in the service definition doesn't match the actual config name The config was deleted while services still reference it
Is the "Error response from daemon: config not found: myconfig" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading