You need to make the script part of the container. To do that, you need to copy the script inside using the COPY
command in the Docker file, e.g. like this
FROM ubuntu:14.04
COPY run_netcat_webserver.sh /some/path/run_netcat_webserver.sh
CMD /some/path/run_netcat_webserver.sh
The /some/path
is a path of your choice inside the container. Since you don't need to care much about users inside the container, it can be even just /
.
Another option is to provide the script externally, via mounted volume. Example:
FROM ubuntu:14.04
VOLUME /scripts
CMD /scripts/run_netcat_webserver.sh
Then, when you run the container, you specify what directory will be mounted as /scripts
. Let's suppose that your script is in /tmp
, then you run the container as
docker run --volume=/tmp:/scripts (rest of the command options and arguments)
This would cause that your (host) directory /tmp
would be mounted under the /scripts
directory of the container.