From a5463e0a3881dccc4bed616085b0d6a9f26911ba Mon Sep 17 00:00:00 2001 From: panda Date: Wed, 22 Aug 2018 00:37:59 +0200 Subject: [PATCH] first commit --- Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 12 ++++++++++++ notes.txt | 6 ++++++ 3 files changed, 62 insertions(+) create mode 100644 Dockerfile create mode 100644 notes.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..40be7c3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +#Download base image ubuntu 16.04 +FROM ubuntu:18.04 +#FROM python:3.6 + +ARG PORT_SSH=2222 +#ARG DIRECTORY_LOGS="/apps/data/pshitt/logs" +#ARG DIRECTORY_DATA="/apps/data/pshitt/data" + +# Update Ubuntu Software repository +RUN apt-get update + +RUN apt-get install -y git python-setuptools python-pip && \ + cd /srv && \ + git clone https://github.com/regit/pshitt.git && \ + mkdir -p /srv/pshitt/keys /srv/pshitt/_LOG && \ + #pip install --upgrade pip && \ + pip install python-daemon && \ + pip install argparse && \ + pip install paramiko && \ + rm -rf /var/lib/apt/lists/* + +#WORKDIR /srv/pshitt + +#COPY ssh_host_rsa_key /apps/data/keyfiles/keyfile +COPY ssh_host_rsa_key /srv/pshitt/keys/ssh_host_rsa_key +#COPY exec_pshitt.sh /srv/pshitt/exec_pshitt.sh + +#RUN chmod +x /srv/pshitt/exec_pshitt.sh + +#ENV PATH /srv/pshitt/:${PATH} +#ENV PORT_SSH ${PORT_SSH} +#ENV THREADS ${THREADS} +#ENV KEYFILE ${KEYFILE} +#ENV DIRECTORY_LOGS ${DIRECTORY_LOGS} +#ENV DIRECTORY_DATA ${DIRECTORY_DATA} + +#EXPOSE ${PORT_SSH} + +EXPOSE 2222 + +#ENTRYPOINT ["/srv/pshitt/exec_pshitt.sh"] + +#ENTRYPOINT /srv/pshitt/./pshitt -p 2222 -k /srv/pshitt/keys/ssh_host_rsa_key -o /srv/pshitt/_LOG/$(date +%Y%m%d%H%M)_data.json -l /srv/pshitt/_LOG/$(date +%Y%m%d%H%M)_log.log && /bin/bash +ENTRYPOINT /srv/pshitt/./pshitt -p 2222 -k /srv/pshitt/_HOST_SSH_KEYS/ssh_host_rsa_key -o /srv/pshitt/_LOG/$(date +%Y%m%d%H%M)_data.json -l /srv/pshitt/_LOG/$(date +%Y%m%d%H%M)_log.log && /bin/bash diff --git a/README.md b/README.md index 24ae19e..3029c76 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ # Docker_Pshitt +#Build the container: + docker build -t pshitt_dockerized . + +#run the container: + docker run -d -v /etc/ssh:/srv/pshitt/_HOST_SSH_KEYS -v /pshitt/_LOG:/srv/pshitt/_LOG --name pshitt_dockerized -p 2222:2222 pshitt_dockerized +notes: +1-the ssh keys used are the same of the host, this is wanted, to avoid using pshitt's default which are always the same thus easily identifiable +2-the logs are written on the local fs in /pshitt/_LOG +3- the port on which pshitt listens is redirected on the host and is 2222 + +#Start the container: + docker start pshitt_dockerized diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..39a9765 --- /dev/null +++ b/notes.txt @@ -0,0 +1,6 @@ +docker build -t pshitt_dockerized . +docker run -d -v /etc/ssh:/srv/pshitt/_HOST_SSH_KEYS -v /pshitt/_LOG:/srv/pshitt/_LOG --name pshitt_dockerized -p 2222:2222 pshitt_dockerized +docker stop pshitt_dockerized +docker start pshitt_dockerized +docker exec -ti pshitt_dockerized bash +