I'm attempting to update the sebp/elk Logstash configuration following the documentation here. I'm running into a situation in which the host file that I am attempting to mount is being mounted as a directory in the container.
I found this related question How to mount a single file in a volume but the notion of running with PWD didn't work for me on Windows as I got the following error:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: invalid reference format
I'm running Docker on Windows 10 (Build 16299.192)
λ docker version
Client:
Version: 17.09.1-ce
API version: 1.32
Go version: go1.8.3
Git commit: 19e2cf6
Built: Thu Dec 7 22:22:26 2017
OS/Arch: windows/amd64
Server:
Version: 17.09.1-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: 19e2cf6
Built: Thu Dec 7 22:28:28 2017
OS/Arch: linux/amd64
Experimental: true
My Docker run command is:
docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it -v d:/docker/elk/logstash-snmp.conf:/etc/logstash/conf.d/logstash-snmp.conf --rm --name elk sebp/elk
I've been able to run other containers with persistent storage out of this disk (SQL Server, Redis, Exist-DB), but I'm not sure if I'm missing something on this. How can I tell Docker to actually mount this as a file and not as a directory.
This works for me:
Note: This approach addresses W10 Home Edition with Docker Toolbox and VirtualBox.
Overview: Create a folder in local-machine, mount this as a shared folder in Docker VM, use this shared folder as a bindmount to Docker container.
docker-machine stop default
default
go to Settings > Shared Folder
c/Users
is binded to your c:\Users
Settings
docker-machine start default
docker-machine ssh default
sudo vi /mnt/sda1/var/lib/boot2docker/profile
Append the following:
# create a directory in VM
mkdir /home/docker/[foldername]
# mount/map shared folder on localmachine to directory
sudo moun -t vboxsf -o uid=1000,gid=50 [local-shared] /home/docker/[foldername]
Save and exit ssh.
docker-machine stop default
docker-machine start default
(or perhaps docker-machine restart default
)docker container run -d -p 1234:6789 -v /[local-shared]/sub-dir:/[container-dir] dockerImage2Run
And it should work.
Ref: http://support.divio.com/local-development/docker/how-to-use-a-directory-outside-cusers-with-docker-toolbox-on-windowsdocker-for-windows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With