これは例として、zabbix-agentを起動するDockerイメージ
Dockerfile
FROM debian:wheezy ENV DEBIAN_FRONTEND noninteractive RUN echo 'deb http://archive.debian.org/debian wheezy main' > /etc/apt/sources.list RUN apt-get update -y && apt-get install -y wget RUN apt-get install -y procps vim RUN \ wget http://repo.zabbix.com/zabbix/2.2/debian/pool/main/z/zabbix-release/zabbix-release_2.2-1+wheezy_all.deb \ && dpkg -i zabbix-release_2.2-1+wheezy_all.deb \ && apt-get update -y \ && apt-get install -y \ zabbix-agent \ && rm -rf /var/lib/apt/lists/* RUN \ mkdir -p /var/run/zabbix \ && chown zabbix.zabbix /var/run/zabbix # configure zabbix web server RUN cp /etc/zabbix/zabbix_agentd.conf /root/zabbix_agentd.conf COPY entrypoint.sh /entrypoint.sh EXPOSE 10050 ENTRYPOINT ["/entrypoint.sh"]
entrypoint.sh
#!/bin/bash if [ ! -f /etc/zabbix/zabbix_agentd.conf ];then cp /root/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf mkdir /etc/zabbix/zabbix_agentd.d/ fi /etc/init.d/zabbix-agent start tail -f /var/log/zabbix/zabbix_agentd.log
zabbix-agent2.2というタグをつけてimageを作りました。
docker image build -t zabbix-agent2.2 .
出来上がったイメージ
# docker images REPOSITORY TAG IMAGE ID CREATED SIZE zabbix-agent2.2 latest 1ae644c4a02d 3 seconds ago 139MB
docker run -d -it --name zabbix zabbix-agent2.2