From ubuntu16.04 Maintainer Arvind Rawat <arvindr226@gmail.com>
RUN sudo apt get update && apt install -y apache2 openssh-server supervisor RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/run/sshd /var/log/supervisor
RUN echo 'root:gotechnies' | chpasswd RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_configRUN sed 's@session\srequired\spam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile" RUN echo "export VISIBLE=now" >> /etc/profile
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.confThe above configuration will add the supervisord.conf file inthe container while build the docker image.
[supervisord] nodaemon=trueLet's enable the required default ports to access the http (port 80) and ssh (port 22) in the Dockerfile and write a line to start supervisor execute using the CMD in Dockerfile.[program:sshd] command=/usr/sbin/sshd -D
[program:apache2] command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
EXPOSE 22 80 CMD ["/usr/bin/supervisord"]
From ubuntu:16.04 Maintainer Arvind Rawat <arvindr226@gmail.com>RUN apt-get update && apt-get install -y openssh-server apache2 supervisor RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/run/sshd /var/log/supervisor
RUN echo 'root:gotechnies' | chpasswd RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config RUN sed 's@session\srequired\spam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd ENV NOTVISIBLE "in users profile" RUN echo "export VISIBLE=now" >> /etc/profile COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf EXPOSE 22 80 CMD ["/usr/bin/supervisord"]
$ docker build -t gotechnies .
docker run -d -p 80:80 -p 2222:22 gotechnies
$ ssh root@localhost -p 2222
Use the password you have added in the Dockerfile.
gotechnies
Check the apache on web browser http://localhost