DNS resolution failing inside docker container when host network changes without rebooting device - docker

Expected behavior
DNS resolution failing inside docker container when host network changes ( network1-192.168.1., network2-192.168.2. ) without rebooting device
docker container running on bridge network
Actual behavior
DNS resolution should be successful in case of host network changes
Steps to reproduce the behavior
Create network container (lets say.. "abc_network.ctr") without specifying network_mode as it takes bridge by default (and it used docker's embedded nameserver inside docker container)
Create another container (xyz.ctr) whose network mode will be "container" ("abc_network.ctr")
/etc/resolv.conf from inside the xyz.ctr container. which is able to resolve nameserver
root#d3e0dc71f370:~# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
/etc/resolv.conf from host.. which is also able to resolve nameserver
root#RP4-2711-c03112-1xb0e6f3b8:~# cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 192.168.1.1
Change network subnet of the machine (remove LAN cable and connect to another subnet network1 -> network2) without reboot.
And try to resolve nameserver inside docker container using following commands:
docker exec -it xyz.ctr bash
apt-get update
result-
root#d3e0dc71f370:~# apt-get update
Err:1 http://security.debian.org/debian-security buster/updates InRelease
Temporary failure resolving 'security.debian.org'
Err:2 http://deb.debian.org/debian buster InRelease
Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
dig output
root#15c396b06f57:~# dig
; <<>> DiG 9.11.5-P4-5.1+deb10u5-Debian <<>>
;; global options: +cmd
;; connection timed out; no servers could be reached
/etc/resolve.conf from host machine which is able to resolve nameserver
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 192.168.2.1
apt-get working on host and dig command shows NO ERROR
Output of docker version:
Docker version 20.10.6, build 370c289
Output of docker info:
root#RP4-2711-c03112-1xb0e6f3b8:~# docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
Server:
Containers: 22
Running: 18
Paused: 0
Stopped: 4
Images: 98
Server Version: 20.10.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.17-v7l+
Operating System: Raspbian GNU/Linux 10 (buster)
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 3.44GiB
Name: RP4-2711-c03112-1xb0e6f3b8
ID: C66C:3DAT:6DLH:PHJA:JR2N:KURB:PTMQ:BHUP:XRIH:FE3H:VSEZ:B7K3
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Default Address Pools:
Base: 172.128.0.1/10, Size: 16
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory TCP limit support
WARNING: No oom kill disable support
Additional environment details (AWS, VirtualBox, physical, etc.)
Device- Raspberry Pi-4B, Intel NUC (This is not an environment specific issue)

Related

ddev on ZFS: Service 'db' failed to build : failed to copy files: copy file range failed: invalid argument

Service 'db' failed to build : failed to copy files: copy file range failed: invalid argument
Happens with any new project after
This error happens when launching any of my ddev projects or when creating a new one with ddev config.
Update: This happens only when docker data (/var/lib/docker by default) is on a ZFS volume. The problem disappeared as soon as I moved it to EXT4.
It does not seem to be a problem with docker or docker compose, as I have launched the example/hello-world containers of both projects successfully.
I have tried removing ~/.ddev, downgrading ddev, and downgrading docker. I was not able to downgrade docker-compose.
Log:
$ ddev start
Starting test...
mkcert may not be properly installed, we suggest installing it for trusted https support, `brew install mkcert nss`, `choco install -y mkcert`, etc. and then `mkcert -install`
Running Command=ip address show dev docker0
Building db
Service 'db' failed to build : failed to copy files: copy file range failed: invalid argument
Failed to start test: Failed to run docker-compose [-f /home/tester/htdocs/test/.ddev/.ddev-docker-compose-full.yaml up --build -d], err='exit status 1', stdout='Step 1/6 : ARG BASE_IMAGE
Step 2/6 : FROM $BASE_IMAGE
---> 33f3288968e4
Step 3/6 : ARG username
', stderr='Building db
Service 'db' failed to build : failed to copy files: copy file range failed: invalid argument'
config.yml
name: test
type: php
docroot: ""
php_version: "7.3"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
mariadb_version: "10.2"
mysql_version: ""
provider: default
use_dns_when_possible: true
composer_version: ""
System:
Docker 20.10.1
docker-compose 1.27.4
Manjaro Linux (Arch derivative)
ZFS 2.0.0-1 (on root)
docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-tp-docker)
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 27
Server Version: 20.10.1
Storage Driver: zfs
Zpool: rpool
Zpool Health: ONLINE
Parent Dataset: rpool/root
Space Used By Parent: 20958640128
Space Available: 282678809088
Parent Quota: no
Compression: off
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b.m
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.2-2-MANJARO
Operating System: Manjaro Linux
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 30.9GiB
Name: testpc
ID: BKDP:GAWJ:BUCV:OVP6:QUKY:UQCZ:AESP:V3AN:EXHE:BWJU:4TT7:YPEO
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Update: This fixed itself after a complete system reinstall; unfortunately I have no idea how the reinstall might have helped.
(Don't have enough reputation to comment, but this isn't a full answer.)
I hit the same issue, also with Docker on Arch w/ZFS. I was able to "fix" it by passing DOCKER_BUILDKIT=0 docker build .... It appears to be an issue somewhere in buildkit.
I haven't dug in any further to see what specifically is causing the issue.

Failed to pull container images via short reference format

I have a problem downloading container images from a private docker registry.
The registry need no authentication credentials and is only available over the
internal network.
I have configured the registries in /etc/docker/daemon.json like the example
below. I have replaced the FQDN.
{
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": [
"https://customer-registry.example.com",
"https://location-a.dev.example.com:17519",
"https://location-b.dev.example.com:17519"
]
}
When I use the short reference format to download the container image
apvxw/build-env-go:4.2.1 I get the following error:
$ docker pull apvxw/build-env-go:4.2.1
Unable to find image 'apvxw/build-env-go:4.2.1' locally
/usr/bin/docker: Error response from daemon: pull access denied for
orbis-u/build-env-go, repository does not exist or may require 'docker login':
denied: requested access to the resource is denied.
When I use the long reference format docker can pull the image
$ docker pull customer-registry.example.com/apvxw/build-env-go:4.2.1
4.2.1: Pulling from apvxw/build-env-go:4.2.1
ac9208207ada: Already exists
5cf798ece9e5: Already exists
510bf5361e28: Already exists
b2f42d2b54d9: Pull complete
4b8be0bf5345: Pull complete
311322fb5cb6: Pull complete
Digest: sha256:f522ce0974ee41dfc7f16fc44682fee77e57bc056e37b27a4bf4885af3f5c375
Status: Downloaded newer image for customer-registry.example.com/apvxw/build-env-go:4.2.1
customer-registry.example.com/apvxw/build-env-go:4.2.1
The same behavior applies to the other configured docker registries.
I have also tested downloading container images via the registries with podman.
There the download via the short reference works fine.
Does anyone have an idea what the problem is because I can't download container
images under Arch using the short notation?
System and docker informations:
$ uname -a
Linux markus-pc 5.5.9-arch1-2 #1 SMP PREEMPT Thu, 12 Mar 2020 23:01:33 +0000 x86_64 GNU/Lin
$
$ docker info
Client:
Debug Mode: false
Server:
Containers: 10
Running: 0
Paused: 0
Stopped: 10
Images: 71
Server Version: 19.03.7-ce
Storage Driver: overlay2
Backing Filesystem: <unknown>
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: systemd
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d76c121f76a5fc8a462dc64594aea72fe18e1178.m
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 5.5.9-arch1-2
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.54GiB
Name: markus-pc
ID: DKFK:PHVZ:LDGJ:54OG:5VJ5:5XYK:YDZR:DJFR:HZ7B:4HDT:LBEK:7JQ4
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: volkerraschek
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://customer-registry.example.com/
https://location-a.dev.example.com:17519/
https://location-b.dev.example.com:17519/
Live Restore Enabled: false
In Docker
The default registry is configured to search images on docker hub which is docker.io. When you pull any image without domain name it will try to pull from docker.io, not from any other registry.
If you want to pull an image from a private registry, then you need to use long reference which is
docker pull <YOUR-DOMAIN>/apvxw/build-env-go:4.2.1
In Podman
You can configure multiple registries and podman searches in all registries whichever configured in the config file.
Location of podman configuration file is /etc/containers/registries.conf. and you can add the following lines in that which you might have already done.
[registries.search]
registries = ['docker.io', 'customer-registry.example.com', 'location-a.dev.example.com:17519', 'location-b.dev.example.com:17519']

Error response "proxyconnect tcp: EOF" from daemon when running docker run hello-world in docker quickstart terminal

I'm running docker toolbox on windows version 10.0.15063 behind corporate proxy, and I'm getting the following error when i run the command docker run hello-world
Unable to find image 'hello-world:latest' locally
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'
I'm getting the same error on attempting to login to docker using docker login.
I've already tried exporting HTTPS_PROXY and HTTP_PROXY in /Docker Toolbox/start.sh and adding the same to my environment variables but none of these approaches seem to be working.
Here's my docker info
$ docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.09.6
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.14.116-boot2docker
Operating System: Boot2Docker 18.09.6 (TCL 8.2.1)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 989.4MiB
Name: default
ID: PNCR:EWZF:D4O3:7KDP:UW7W:4NEO:YGTT:CHWV:VF5U:YTE6:GD66:WKHS
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: http://xxxx:xxxx
HTTPS Proxy: https://xxxxx:xxxx
No Proxy: 192.168.99.100
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Here's what i get on ssh-ing into the default machine and running sudo vi /var/lib/boot2docker/profile
CACERT=/var/lib/boot2docker/ca.pem
DOCKER_HOST='-H tcp://0.0.0.0:2376'
DOCKER_STORAGE=aufs
DOCKER_TLS=auto
SERVERKEY=/var/lib/boot2docker/server-key.pem
SERVERCERT=/var/lib/boot2docker/server.pem
export "HTTP_PROXY=http://proxy2:8080"
export "HTTPS_PROXY=https://proxy2:8080"
export "NO_PROXY=192.168.99.100"
I'm I missing something? I've been working on this for the last hour without any luck.
I actually figured it out.
I was initially using corporate network while working on this, and the networking team has blacklisted every ip and then white-listed the trusted ones. That was what was causing the whole problem while trying to connect to an external registry.
These are the steps I followed to fix the issue:
I switched to my personal network then disabled the proxy ie. Under Internet Properties > Switch to automatic Configuration > Automatically detect settings.
Removed the HTTP_PROXY and HTTPS_PROXY exports from start.sh in C:\Program Files\Docker Toolbox
Opened Windows Firewall > Advanced Settings > Inbound Rules > Add New Rule; Then
Created a Custom rule with a range ip range of 1-100, then named it Docker.
Deleted the .Virtualbox folder from C:\Users\myusername*
Restarted Docker Quickstart Terminal. It created a new default docker-machine and updated the configuration settings, and now pulling images from external registries is working fine.

Docker Hub login behind a proxy

I recently installed Docker 18.04.0-ce on my Ubuntu 17.10 VM. While working behind a proxy I got stuck trying to log in into the Docker Hub registry. So when I run:
docker login -u <username> -p <cool password>
And I get this message:
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http:
request canceled while waiting for connection (Client.Timeout exceeded while
awaiting headers)
As far as my understanding goes from the research I did is that when you are behind a proxy and you want to use Docker you need to configure it accordingly even though having set your environment variable like so:
http_proxy=<my_proxy>
https_proxy=<my_proxy>
HTTP_PROXY=<my_proxy>
HTTPS_PROXY=<my_proxy>
Second, it looks like that Docker has multiple levels of proxy configurations meaning different configuration for build, containers, and the daemon.
I went and configured all of those to match my proxy, but I still get that message. YES, I DID RESTART the service and the daemon.
UPDATE:
$ docker info
Containers: 8
Running: 0
Paused: 0
Stopped: 8
Images: 12
Server Version: 18.04.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.13.0-39-generic
Operating System: Ubuntu 17.10
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 7.79GiB
Name: docker-vb
ID: 447I:6DFI:JZ7V:F6SZ:BUCB:IFB2:4HGT:MXK2:Y5H5:EECC:FIQN:SZOH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: http://<proxy_ip>:<proxy_port>
HTTPS Proxy: http://<proxy_ip>:<proxy_port>
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
The docker login typically needs to be run with sudo priviledges, so ensure that the HTTPS_PROXY environment is actually preserved. Simply done by
export HTTPS_PROXY=<your proxy>
Or simply pass it on the command line:
sudo HTTPS_PROXY=<your proxy> docker login -u <user> <registry>
The docker daemon doesn't need to be restarted.
The above works fine (we use extensivelye proxies at work).
There may be some issues with your network reachability, proxy, and possibly the registry. The docker log can provide some clues:
Ubuntu: sudo journalctl -fu docker.service
RHEL: /var/log/messages | grep docker

Docker Nginx Mount "Are you trying to mount a directory onto a file (or vice-versa)?"

I've been trying to do a backup system for my dockers and everything works fine for databases containers except for the webserver's one which runs under Nginx. I've been looking around and it seems I'm not the only one having this issue, I have however not been able to find a solution.
Steps:
# docker load -i /path/to/backup-image.tar
# docker run \
> -v $(pwd)/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/custom-php.ini:/usr/local/etc/php/conf.d/custom-php.ini \
> -v $(pwd)/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/opcache-recommended.ini:/usr/local/etc/php/conf.d/opcache-recommended.ini \
> -v $(pwd)/volumes/home/project/project-git-repo/project-docker/volumes/wp-content:/var/www/html \
> -v $(pwd)/volumes/tmp/html/.well-known:/var/www/html/.well-known \
> --name websrv project_backup_tmp
This last command outputs:
container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\\"/tmp/project_restore/docker/7aa016ba40e9/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/custom-php.ini\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06\\\" at \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06/usr/local/etc/php/conf.d/custom-php.ini\\\" caused \\\"not a directory\\\"\""
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\\"/tmp/project_restore/docker/7aa016ba40e9/volumes/home/project/project-git-repo/project-docker/volumes/php-conf/custom-php.ini\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06\\\" at \\\"/var/lib/docker/aufs/mnt/b23066c3007d106ae9364ca4e2603e4d5a3e63a0f47d2669ca6580be735adb06/usr/local/etc/php/conf.d/custom-php.ini\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
ERRO[0001] error waiting for container: context canceled
Here is the result of my docker info:
Containers: 14
Running: 1
Paused: 0
Stopped: 13
Images: 79
Server Version: 17.06.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 184
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-83-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 19.59GiB
Name: rajiska-server
ID: 4YFX:52ZF:QKGV:IMY4:6PP4:6P33:JXGT:QHJW:MZTI:QVVX:YU77:ZGR6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
I've across the same issue and it is generally about trying to mount a file on the host to a container running in another machine or VM.
So if the containers you're running are in a VirtualBox VM or some other machine than your local, you must find another way to sync your directories.
However, if you're using docker-machine to setup your VirtualBox VM, it usually mounts your /home directory to /hosthome on the created VM.
For instance, if your project is situated in your home directory, then it could be mounted like this:
docker run -v /hosthome/USERNAME/PROJECT:/path/on/container imagename
Where:
USERNAME is your username on the host machine
PROJECT is the name of the project directory on the host machine
The same error appeared while setting up the elk:
The reason for the error was I had manually named the config file with a Capital letter c in my computer while in docker searching for home/imusebe/elastdocker/elasticsearch/config/elasticsearch.yml.
Setting this got things running.

Resources