Last active
September 18, 2022 04:05
-
-
Save redtripleAAA/9730666d783f0702bfb1754798f0e826 to your computer and use it in GitHub Desktop.
Dockerfile Template for Workloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################# | |
# The following .dockerfile can be used as a docker image for the following repo # https://github.com/brian1917/workloader | |
# Published Docker image can be used from Dockerhub # ansred/ubuntu-workloader-ssh # https://hub.docker.com/repository/docker/ansred/ubuntu-workloader-ssh | |
# This docker file will use Ubuntu AMD64 image and install all utility packages, inlcuding OpenSSH Server to access to the server # user= testuser # password=testpassword and port exposed 22 | |
# You can build this dockerfile (Make sure to change credentials used for OpenSSH | |
# Make sure to edit pce.yaml as well with your Workloader information of simply used pce-add command | |
# Tip # You can use to test the dockerhub test image # https://labs.play-with-docker.com/ | |
# Just run # "docker run -d -p 2022:22 --name workloader-ssh ansred/ubuntu-workloader-ssh" | |
# Note this flag if you wish delete the container when it stops --rm "docker run --rm -d -p 2022:22 --name workloader-ssh ansred/ubuntu-workloader-ssh" | |
# Example ssh -p 2022 [email protected] | |
# This dockerfile will automatically downloaded the latest linux repo for workloader from github and extract it for you to use at # /var/workloader/linux/linux-v8.24.6 | |
#!/bin/bash | |
################################################################################################## | |
#image ansred/ubuntu-workloader-ssh | |
#!/bin/bash | |
FROM amd64/ubuntu | |
RUN apt-get update && apt-get upgrade -y | |
RUN apt-get install -y byobu curl git htop man zip unzip vim wget nano sudo openssh-server sshpass iputils-ping telnet traceroute | |
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 testuser | |
RUN echo 'testuser:testpassword' | chpasswd | |
RUN service ssh start | |
EXPOSE 22 | |
ENV TERM linux | |
ENV DEBIAN_FRONTEND noninteractive | |
################################################# | |
#Create directory for Workloader linux | |
RUN cd /var | |
RUN mkdir /var/workloader | |
RUN mkdir /var/workloader/linux | |
RUN cd /var/workloader/linux && curl https://api.github.com/repos/brian1917/workloader/releases/latest | grep "browser_download_url.*linux.*.zip" | cut -d ':' -f 2,3 | tr -d \" | wget -O workloader-linux.zip -qi - | |
RUN cd /var/workloader/linux && unzip workloader-linux.zip | |
#RUN export PATH=$PATH$( find /var/workloader/ -type d -printf ":%p" ) | |
RUN cd /var/workloader/linux/linux* | |
RUN cd /var/workloader/linux/linux* && ./workloader version | |
RUN chmod -R 777 /var/workloader/linux | |
CMD ["/usr/sbin/sshd","-D"] | |
################################################################################################## |
Docker Compose
#################################################
version: '3.3'
services:
ubuntu-workloader-ssh:
ports:
- '2022:22' # To be used for SSH to the container and ssh -p 2022 [email protected] and password is "testpassword"
container_name: workloader-ssh
image: ansred/ubuntu-workloader-ssh
#################################################
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example line-by-line from after deploying the container
docker run -d -p 2022:22 --name workloader-ssh ansred/ubuntu-workloader-ssh
and then ssh to it
ssh -p 2022 [email protected]
[node2] (local) [email protected] /
root@cbb6351f6db8:/var/workloader/linux/linux-v8.24.6# ls