├── Dockerfile ├── LICENSE ├── README.md ├── apache2.start ├── container-controller.start ├── webmin.configure ├── webmin.launch ├── webmin.start └── webmin.stop /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tragus/apache 2 | 3 | MAINTAINER James Johnson 4 | 5 | EXPOSE 80 6 | 7 | # Perform build-time configuration of the container 8 | COPY webmin.configure /usr/local/bin/webmin.configure 9 | RUN chmod +x /usr/local/bin/webmin.configure && /usr/local/bin/webmin.configure 10 | 11 | # Install any other scripts 12 | COPY apache2.start /usr/local/lib/container-controller/start/ 13 | COPY webmin.start /usr/local/lib/container-controller/start/ 14 | COPY webmin.stop /usr/local/lib/container-controller/stop/ 15 | COPY container-controller.start /usr/local/bin/container-controller.start 16 | 17 | RUN chmod +x /usr/local/lib/container-controller/start/apache2.start 18 | RUN chmod a+x /usr/local/bin/container-controller.start 19 | RUN echo root:webmin | chpasswd 20 | 21 | ENTRYPOINT ["/usr/local/bin/container-controller.start"] 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 James Johnson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tragus/webmin 2 | tragus/apache with webmin installed & configured 3 | 4 | I use this to provide easy configuration for more complex server images 5 | (e.g. -- nfs). 6 | Be sure that you map any configuration files/directories to permanent storage. 7 | 8 | ## Building the image 9 | 10 | ``` 11 | git clone https://github.com/jcejohnson/docker-webmin.git tragus-webmin 12 | cd tragus-webmin 13 | docker build -t tragus/webmin . 14 | ``` 15 | 16 | ## Running the container 17 | 18 | Modify & use webmin.launch to start the container. Use webmin.shutdown to 19 | cleanly shutdown the server or docker stop to terminate the instance more or 20 | less immediately. 21 | 22 | ``` 23 | docker run -d -p 80:80 -v /var/run/webmin:/var/run/container-control --name webmin tragus/webmin 24 | ``` 25 | 26 | ## Persistent Data 27 | 28 | webmin seems to keep things at: 29 | 30 | - /var/webmin 31 | - /etc/webmin 32 | 33 | I suggest mapping both of those to an out-of-container location. 34 | 35 | ## TODO 36 | This is in very early development. tragus/apache needs to be refactored 37 | to use runsvdir and then I will do the same here. Unlike apache, however, 38 | we will not monitor config files. I'm not quite sure what I'll monitor and, 39 | in fact, inotifywait might just be the wrong thing to do. 40 | 41 | ## See Also 42 | Please read the tragus/apache documentation to for current warnings: 43 | https://github.com/jcejohnson/docker-apache 44 | -------------------------------------------------------------------------------- /apache2.start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Provide control over apache's listening address:port 4 | # Derived containers can override this with the '-e' paramter to 'docker run' 5 | [ -z "$apache_ipaddress" ] && apache_ipaddress="0.0.0.0" 6 | [ -z "$apache_http" ] && apache_http="80" 7 | [ -z "$apache_https" ] && apache_https="443" 8 | export apache_ipaddress apache_http apache_https 9 | 10 | # start service in background here 11 | /usr/bin/service apache2 start 12 | 13 | : 14 | -------------------------------------------------------------------------------- /container-controller.start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # jcejohnson 4 | # 5 | # Modified from https://docs.docker.com/reference/builder/ 6 | # 7 | # read was misbehaving with /bin/sh and my base is ubuntu so I'm using /bin/bash 8 | 9 | # 'docker stop' will stop a running container by sending SIGTERM and then SIGKILL 10 | # after a grace period. 11 | 12 | # When the script receives SIGTERM the read is interrupted and the script exits. 13 | # That doesn't let us do any cleanup. By trapping SIGTERM we can invoke the 14 | # _stop_services function. Traps are supposed to be quick so you shouldn't do too 15 | # much in your stop hooks. 16 | trap "_stop_services ; exit 0" HUP INT QUIT KILL TERM 17 | 18 | args="$@" 19 | 20 | function _start_services { 21 | echo "Starting services" 22 | for i in /usr/local/lib/container-controller/start/* 23 | do 24 | echo "...$i" 25 | [ -x "$i" ] && $i "$@" 26 | done 27 | } 28 | 29 | function _stop_services { 30 | echo "Stopping services" 31 | for i in /usr/local/lib/container-controller/stop/* 32 | do 33 | echo "...$i" 34 | [ -x "$i" ] && $i $args 35 | done 36 | } 37 | 38 | _start_services "$@" 39 | 40 | echo "Connect to Webmin using http://$(hostname -I | awk '{print $1}')/webmin/" 41 | echo "Log in with username: root and password: webmin" 42 | 43 | tail -f /dev/null 44 | -------------------------------------------------------------------------------- /webmin.configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export DEBIAN_FRONTEND=noninteractive 4 | 5 | /bin/rm -f /etc/apt/apt.conf.d/docker-gzip-indexes 6 | 7 | /usr/bin/apt-get update && /usr/bin/apt-get -y install wget || exit 100 8 | 9 | echo deb http://download.webmin.com/download/repository sarge contrib >> /etc/apt/sources.list || exit 100 10 | echo deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib >> /etc/apt/sources.list || exit 100 11 | (/usr/bin/wget -q http://www.webmin.com/jcameron-key.asc -O- | /usr/bin/apt-key add -) || exit 100 12 | 13 | /usr/bin/apt-get update && /usr/bin/apt-get -y --force-yes install webmin || exit 100 14 | 15 | /bin/cat >> /etc/webmin/config <> /etc/apache2/apache2.conf <> /etc/apache2/envvars 37 | echo export apache_http=80 >> /etc/apache2/envvars 38 | echo export apache_https=443 >> /etc/apache2/envvars 39 | echo ServerName apache2.docker >> /etc/apache2/apache2.conf 40 | 41 | : 42 | -------------------------------------------------------------------------------- /webmin.launch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Sample script for launching the webmin container 4 | 5 | docker kill webmin 6 | docker rm webmin 7 | docker run -d -t -p 80:80 --name webmin tragus/webmin 8 | -------------------------------------------------------------------------------- /webmin.start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/bin/service webmin start 4 | 5 | : 6 | -------------------------------------------------------------------------------- /webmin.stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /etc/init.d/webmin stop 4 | 5 | : 6 | --------------------------------------------------------------------------------