Add a new shell script configure_slave.sh as following:
#!/bin/bash dnf install java-1.8.0-openjdk git wget openssh-server passwd sudo -y useradd jenkins && echo redhat|passwd jenkins --stdin grep jenkins /etc/sudoers || echo "jenkins ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers sed -i 's/Defaults requiretty/#Defaults requiretty/' /etc/sudoers ssh-keygen -A
Touch a Dockerfile as following:
FROM fedora ADD configure_slave.sh /root/ RUN sh -x /root/configure_slave.sh CMD /usr/sbin/sshd
docker build -t jenkins_slave .