admin/ March 15, 2017/ Docker, Linux/ 0 comments




Why Supervisor with Docker?

Generally, a Docker container starts with a single process when it is launched, for example, an Apache daemon or an SSH server daemon. Often though you want to run more than one process in a container. There are a number of ways you can achieve this ranging from using a simple Bash script as the value of your container’s CMD instruction to installing a process management tool.

GITHUB URL -: https://github.com/arvindr226/supervisord.git

Let’s start with supervisor to run multiple processes in the single container.

Create a Dockerfile
Choose Ubuntu LTS 16.04 default image.

Install the apache2, OpenSSH-server, and supervisor.

Configure the ssh for root user in Dockerfile

Add a supervisor configuration file

The above configuration will add the supervisord.conf file in the container while building the docker image.

Add the below content in the supervisord.conf

Exposing ports with running Supervisor

Let’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.


Your Final complete Dockerfile will look like below.

Now build your docker image with this Dockerfile

Start your docker container like below


Try to connect with the ssh server

Use the password you have added in the Dockerfile.

Check the apache on the web browser http://localhost


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.