docker how do I make host scripts available inside a container
I am working with a kalilinux-based docker container (dnraikes/kali-net).
I am developing some proprietary scripts to run various security tools against our in-house servers so I don’t want to embed the scripts inside the docker image using either the
ADD commands in my Dockerfile.
My scripts are in
~/scripts on the docker host.
when I run the docker container with the command:
$ docker run -it -v /opt/scripts:~/scripts dnraikes/kali-net /bin/bash
Once inside the container, if I switch to
/opt there is no scripts folder.
Also, any results from the scripts must be visible on the docker host after the container has been either killed or stopped.
What am I doing wrong.
One Solution collect form web for “docker how do I make host scripts available inside a container”
Try switching the directory locations like this:
$ docker run -it -v /home/<username>/scripts:/opt/scripts dnraikes/kali-net /bin/bash
From the documentation on volumes,
Also note that
host-src must be an absolute path so replace
/home/<username>/scripts or the full path to your