Docker Community Forums

Share and learn in the Docker community.

Dockerfile - Not Able to append content to a file

(Supermario18b) #1

Hi, I’m new to Dockerfile and I try to create an image. I’d like to append some content to a file, I see no error, the Image seems to be fine but the file is the same as before. The part is this:

RUN mkdir -p /opt/statusengine/module && \	
	cp /tmp/module/src/bin/nagios/statusengine.o /opt/statusengine/module/statusengine-nagios.o && \
	echo "broker_module=/opt/statusengine/module/statusengine-nagios.o \
use_process_data=0 \
use_system_command_data=0 \
use_comment_data=0 \
use_external_command_data=0 \
use_flapping_data=0 \
use_notification_data=0 \
use_program_status_data=0 \
use_contact_status_data=0 \
use_contact_notification_data=0 \
use_event_handler_data=0 \
use_object_data=0 \
use_restart_data=1 \
use_service_perfdata=1" >> /opt/nagios/etc/nagios.cfg

If I try to write the content to /tmp/test.cfg it works. Could you please point me to the right direction?

Thanks :slight_smile:

Edit: I forgot that with “docker run” I bind also that file to another… Tomorrow I’ll test again and if everything is ok I mark the topic as solved.

(Supermario18b) #2

That was the Problem and naturally it could not work but I still no have a solution. I create the image and if I check in the container the nagios.cfg is like before…