Compare commits

..

6 Commits

Author SHA1 Message Date
Asif Bacchus e4fdd4c16b update to alpine 3.12 2020-12-31 01:49:58 -07:00
Asif Bacchus 4401e1b2b6 update comments and label descriptions 2020-02-07 07:52:22 -07:00
Asif Bacchus 1724b25dcc update readme 2020-02-07 07:51:18 -07:00
Asif Bacchus f0f701e2ea update readme 2020-02-07 07:33:19 -07:00
Asif Bacchus c5ab25c706 update cmd label to point to help cmd 2020-02-07 07:23:31 -07:00
Asif Bacchus 68cb4e425f add built-in help 2020-02-07 07:23:23 -07:00
3 changed files with 40 additions and 6 deletions
+4 -4
View File
@@ -1,12 +1,12 @@
# simple netcat (BSD) persistent echo server running on port 5555
# simple netcat (BSD) persistent "listen" server running on port 5555
# running on Alpine Linux
FROM alpine:3.11
FROM alpine:3.12
# standardized labels
LABEL maintainer="Asif Bacchus <asif@bacchus.cloud>"
LABEL org.label-schema.cmd="docker run [-d|-it] --init --rm -p [<ipaddr>:]<host port>:5555 [--name ab-netcat] [-e TZ=timezone] docker.asifbacchus.app/ab-netcat [/bin/sh]"
LABEL org.label-schema.description="Persistent netcat (BSD) echo server on Alpine Linux"
LABEL org.label-schema.cmd="docker run --rm docker.asifbacchus.app/ab-netcat help"
LABEL org.label-schema.description="Persistent netcat (BSD) listen server on Alpine Linux"
LABEL org.label-schema.name="ab-netcat"
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.url="https://git.asifbacchus.app/ab-docker/ab-netcat"
+13 -1
View File
@@ -1,3 +1,15 @@
# ab-netcat
Simple netcat echo server on customizable port
Simple BSD-style netcat (NC) persistent "listen" server running on Alpine Linux. Run `docker run --rm docker.asifbacchus.app/ab-netcat help` for a quick-reference usage overview.
## Container usage
General usage:
`docker run [-d|-it] --init --rm -p [<ipaddr>:]<host port>:5555 [--name ab-netcat] [-e TZ=timezone] docker.asifbacchus.app/ab-netcat [/bin/sh]`
Please consult the repo [wiki](https://git.asifbacchus.app/ab-docker/ab-netcat/wiki) for detailed usage instructions and notes.
## Questions, Suggestions or Comments
Please create an issue if anything needs to be fixed or you have suggestions for enhancements. Otherwise, I hope it's useful to you!
+22
View File
@@ -4,6 +4,28 @@
### run supplied CMD
#
convertCase () {
printf "%s" "$1" | tr "[:upper:]" "[:lower:]"
}
# check if requesting help
isHELP=$( convertCase "$1" )
if [ "$isHELP" = 'help' ]; then
# display help
printf "\n\n--- ab-netcat usage ---\n\n"
printf "This container can be run in several ways, more details in the repo wiki at https://git.asifbacchus.app/ab-docker/ab-netcat/wiki\n\n"
printf "In all cases, this container is a persistent listener. General execution is:\n"
printf "docker run [-d|-it] --init --rm -p [<ipaddr>:]<host port>:5555 [--name ab-netcat] [-e TZ=timezone] docker.asifbacchus.app/ab-netcat\n\n"
printf "neither '-d' or '-it': Run in the foreground and display what's being received.\n\n"
printf "'-d': Run detached, you will have to run 'docker logs -f ab-netcat' to see what the container is receiving from connected client(s).\n\n"
printf "'-it': Run interactively. You can respond to clients or even chat :-)\n\n"
printf "'--init': This allows you to use ctrl-c to terminate container instead of having to run 'docker stop ab-netcat' or 'docker rm -f ab-netcat'. Only useful when running in the foreground or interactively.\n\n"
printf "'-e TZ=timezone': The container will default to UTC time, but you can change it using this environment variable. Ex: '-e TZ=America/Edmonton'\n\n"
printf "You can run the container and supply '/bin/sh' after the container name if you want to be dumped to a shell instead of automatically running netcat. If you're doing that, remember to also pass '-it':\n"
printf "Ex: docker run -it --rm -p 127.0.0.1:5555:5555 docker.asifbacchus.app/ab-netcat /bin/sh\n"
printf "\n--- end of help ---\n\n"
else
exec "$@"
fi
#EOF