Docker Community Forums

Share and learn in the Docker community.

Multiple service in one container

Dear Experts/Members,

Am new to docker learning putting my head around learning concepts, i have POC to perform based on below request, requesting your valuable inputs if this can be achieved.

  • Issue type : Multiple service in one container
  • OS Version/build : Ubuntu 18.04/Docker version 19.03.12, build 48a66213fe
  • App version : Zabbix 4.2, Zabbix Agent, Postgres latest & Snmpd.

Performed Following steps:

  1. docker run ubuntu:16.04 -td
  2. docker exec -it ******* /bin/bash

From inside container following commands executed
#apt-get update
#apt install zabbix-server-pgsql zabbix-frontend-php php7.0-pgsql zabbix-agent
#apt-get install postgresql
#apt-get update && apt-get install -yq snmp snmpd

Performed some required config changes to zabbix & postgresql

#/etc/init.d/postgresql start
#/etc/init.d/zabbix-server start
#/etc/init.d/apache2 start
#/etc/init.d/snmpd start

All service started without any errors and committed the running image with alternate name.

3)docker commit
4) Stopped running image and performed docker run with required ports exposed in detached mode.

Able to get Zabbix GUI over host IP but snmpd service is in stopped state always depite starting many times.

IMPORTANT QUESTION TO EXPERTS IS CAN WE RUN CONTAINER AS ABOVE SETUP IF YES ANY SUGGESTION TO BUILD IN PROPER WAY.

Regards
Mohammed Suhail

A container’s main running process is the ENTRYPOINT and/or CMD at the end of the Dockerfile . It is generally recommended that you separate areas of concern by using one service per container. That service may fork into multiple processes (for example, Apache web server starts multiple worker processes).