How to fix Error response from daemon: invalid argument in Docker
This generic Docker error occurs when the daemon receives malformed input, such as incompatible storage driver configurations, invalid volume mount options, incorrect port mappings, or filesystem compatibility issues.
Quick fix
Fixes Error response from daemon: invalid argument
# View recent Docker daemon logs
sudo journalctl -u docker.service -n 100 --no-pager
# Try running dockerd directly to see verbose errors
sudo dockerd --debug
# Check Docker info for storage driver details
docker info- Check the full error message and Docker logs
- Verify XFS filesystem d_type support (storage driver issues)
- Fix volume mount issues (CIFS/NFS)
- Verify command syntax and argument order
# View recent Docker daemon logssudo journalctl -u docker.service -n 100 --no-pager# Try running dockerd directly to see verbose errorssudo dockerd --debug# Check Docker info for storage driver detailsdocker infoError response from daemon: invalid argument
What this error means
The "Error response from daemon: invalid argument" message is a generic error that Docker returns when it cannot process a request due to malformed or incompatible parameters. Unlike specific error codes, this error can originate from various subsystems within Docker. The most common scenarios triggering this error include: - Storage driver incompatibility (e.g., overlay on XFS without d_type support) - Invalid volume mount specifications (CIFS/NFS mounts with incorrect options) - Malformed port mappings or container run arguments - Filesystem operations that fail due to kernel or driver limitations - Docker daemon configuration conflicts Because this error is generic, troubleshooting requires examining the full error context and Docker logs to identify which component is failing and why.
Typical symptoms
- Docker commands fail with 'Error response from daemon: invalid argument'
- Container creation or startup fails without a specific error code
- Volume mounts fail when using CIFS, NFS, or network filesystems
- Docker build or run commands exit unexpectedly
- docker cp command fails when copying files to/from containers
- Docker daemon fails to start after system or kernel updates
- Port mapping arguments rejected with invalid argument error
Common causes
- XFS filesystem without d_type support when using overlay storage driver
- Invalid or incompatible volume mount options (CIFS/NFS configuration)
- Malformed port mapping syntax in docker run or docker-compose
- Storage driver conflicts after Docker or kernel upgrade
- Missing kernel modules required by the storage driver
- Incorrect command syntax (options after image name, missing spaces)
- Host network mode used with port bindings (incompatible)
- Corrupted Docker data directory or state
- Path issues on Windows (drive letters in volume paths)
- Docker-in-Docker (DinD) volume mount conflicts
How to fix "Error response from daemon: invalid argument"
First, examine the complete error output and Docker daemon logs for more context:
# View recent Docker daemon logs
sudo journalctl -u docker.service -n 100 --no-pager
# Try running dockerd directly to see verbose errors
sudo dockerd --debug
# Check Docker info for storage driver details
docker infoThe error message may include additional context like:
- "mkdir /var/lib/docker/overlay/...: invalid argument" (storage driver issue)
- "error while mounting volume": invalid argument" (volume mount issue)
- A specific path or operation that failed
If the error mentions overlay or storage driver issues, check your XFS filesystem configuration:
# Check Docker's storage driver info
docker info | grep -A 5 "Storage Driver"Look for:
- Storage Driver: overlay or overlay2
- Backing Filesystem: xfs
- Supports d_type: false (this is the problem!)
If d_type is false, you have two options:
Option 1: Reformat the XFS filesystem with ftype=1 (destructive):
# Warning: This erases all data!
mkfs.xfs -n ftype=1 /dev/your_deviceOption 2: Use a different storage driver:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<EOF
{
"storage-driver": "devicemapper"
}
EOF
sudo systemctl restart dockerFor CIFS/SMB network volume errors, ensure you include the addr option when using hostnames:
# Wrong: Using hostname without addr option
docker volume create --driver local \
--opt type=cifs \
--opt device=//myserver/share \
--opt o=username=user,password=pass myvolume
# Correct: Include addr option for hostname resolution
docker volume create --driver local \
--opt type=cifs \
--opt device=//myserver/share \
--opt o=addr=myserver,username=user,password=pass myvolumeFor NFS mounts, use proper quoting with the --mount flag:
docker run --mount 'type=volume,dst=/data,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/path/to/share,"volume-opt=o=addr=10.0.0.1,rw,nfsvers=4"' myimageUse IP addresses instead of hostnames when possible to avoid DNS issues.
Docker is strict about command syntax. Common mistakes include:
Wrong: Options after image name
docker run nginx -p 8080:80 # Wrong!Correct: Options before image name
docker run -p 8080:80 nginx # CorrectWrong: Missing space in port mapping
docker run -p 4242:4242nginx # Wrong - no space before imageCorrect: Proper spacing
docker run -p 4242:4242 nginx # CorrectWrong: Port range to single port
docker run -p 8080-8090:80 nginx # Invalid - range to single portCorrect: Matching ranges
docker run -p 8080-8090:80-90 nginx # Correct - matching rangesUsing host network mode with port bindings causes an invalid argument error:
Wrong:
# docker-compose.yml
services:
web:
network_mode: host
ports:
- "8080:80" # Invalid with host network!Correct: Remove port bindings when using host mode (ports are already exposed):
services:
web:
network_mode: host
# No ports needed - container uses host's network directlyOr remove host mode to use port mappings:
services:
web:
ports:
- "8080:80"On Windows (especially Docker Toolbox), volume paths need special handling:
Wrong: Standard Windows path
docker run -v c:\Users\me\data:/data myimageCorrect: Unix-style path with leading slash
docker run -v /c/Users/me/data:/data myimageOr use forward slashes and proper escaping:
docker run -v "//c/Users/me/data:/data" myimageIn PowerShell, use ${PWD} for the current directory:
docker run -v "${PWD}:/app" myimageIf the error persists, Docker's internal state may be corrupted:
# Stop Docker
sudo systemctl stop docker
# Remove Docker's data (WARNING: deletes all containers and images!)
sudo rm -rf /var/lib/docker
# Restart Docker
sudo systemctl start dockerAlternatively, use Docker's prune commands for a less destructive cleanup:
docker system prune --all --volumesFor Docker Desktop, use the "Reset to factory defaults" option in Settings > Troubleshoot.
After applying fixes, verify Docker is working correctly:
# Check Docker daemon status
sudo systemctl status docker
# View Docker configuration
docker info
# Test container creation
docker run --rm hello-world
# Test volume mounts (if that was the issue)
docker run --rm -v /tmp:/test alpine ls /testIf the error mentioned a specific operation (like docker cp), test that operation specifically to confirm the fix.
Advanced notes
Understanding XFS d_type:
The d_type (directory entry type) feature allows the filesystem to store file type information in directory entries. The overlay/overlay2 storage driver requires this for efficient operation. XFS filesystems created without ftype=1 (default before XFS v5) don't support d_type.
Check your XFS format:
xfs_info /dev/your_device | grep ftype- ftype=1 means d_type is supported
- ftype=0 means you need to reformat or use a different storage driver
Docker-in-Docker (DinD) Considerations:
Running DinD with host volume mounts can fail with "invalid argument" because the overlay2 driver has trouble with layered filesystems:
# This often fails:
docker run --privileged -v /host/path:/var/lib/docker docker:dind
# Workaround: Don't mount /var/lib/docker, or use a different path
docker run --privileged docker:dindKernel Module Requirements:
Some storage drivers require specific kernel modules:
# For overlay2
sudo modprobe overlay
# Check if loaded
lsmod | grep overlayYAML Parsing Gotchas in Docker Compose:
Ports below 60 in HOST:CONTAINER format may be parsed as base-60 values by YAML. Always quote port mappings:
ports:
- "22:22" # Correct - quoted string
- 22:22 # Risky - may be parsed incorrectlyDebugging Generic Errors:
When "invalid argument" provides no additional context, increase Docker's verbosity:
# Start daemon with debug logging
sudo dockerd --debug --log-level=debug
# Or add to daemon.json
{
"debug": true,
"log-level": "debug"
}Frequently asked questions
- What does "Error response from daemon: invalid argument" mean?
- The "Error response from daemon: invalid argument" message is a generic error that Docker returns when it cannot process a request due to malformed or incompatible parameters. Unlike specific error codes, this error can originate from various subsystems within Docker. , overlay on XFS without d_type support) - Invalid volume mount specifications (CIFS/NFS mounts with incorrect options) - Malformed port mappings or container run arguments - Filesystem operations that fail due to kernel or driver limitations - Docker daemon configuration conflicts Because this error is generic, troubleshooting requires examining the full error context and Docker logs to identify which component is failing and why.
- How do I fix "Error response from daemon: invalid argument"?
- This generic Docker error occurs when the daemon receives malformed input, such as incompatible storage driver configurations, invalid volume mount options, incorrect port mappings, or filesystem compatibility issues.
- What causes "Error response from daemon: invalid argument"?
- XFS filesystem without d_type support when using overlay storage driver Invalid or incompatible volume mount options (CIFS/NFS configuration) Malformed port mapping syntax in docker run or docker-compose
- Is the "Error response from daemon: invalid argument" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚Docker Official Documentation
- 📖Troubleshooting the Docker daemon - Docker Docs(Official Docs)
- 📖Select a storage driver - Docker Docs(Official Docs)
- 📖Troubleshoot and diagnose - Docker Docs(Official Docs)
- 🐙
- 🐙
- 🐙
- 💬Invalid argument running docker-compose up - Stack Overflow(Stack Overflow)
- 💬
- 💬
- 💬docker: Error mounting: invalid argument - Arch Linux Forums(Stack Overflow)
- 💬Docker Mounting Error - Docker Community Forums(Stack Overflow)