I got the following command to run the docker (following the running command in https://hub.docker.com/r/manios/nagios )
DOCKER_CONFIGS=$(pwd)
docker run --name nagios
-v $DOCKER_CONFIGS/conf/etc/:/opt/nagios/etc/
-v $DOCKER_CONFIGS/conf/var:/opt/nagios/var/
-v $DOCKER_CONFIGS/conf/custom-plugins:/opt/Custom-Nagios-Plugins
-v $DOCKER_CONFIGS/conf/ssmtp/ssmtp.conf:/etc/ssmtp/ssmtp.conf
-p 0.0.0.0:8990:80
manios/nagios:latest
And I’m getting the following error
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/pi/docker/nagios/conf/ssmtp/ssmtp.conf" to rootfs at "/etc/ssmtp/ssmtp.conf": mount /home/pi/docker/nagios/conf/ssmtp/ssmtp.conf:/etc/ssmtp/ssmtp.conf (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
ERRO[0001] error waiting for container:
The issue is that docker tries to mount a folder to a file. Inside the docker container I can see /etc/ssmtp/ssmtp.conf as a file. and $DOCKER_CONFIGS/conf/ssmtp/ssmtp.conf creating as a folder. How do I resolve this issue?
2
Answers
Have you checked whether
/home/pi/docker/nagios/conf/ssmtp/ssmtp.conf
is existing on your machine?I could imagine that if this path (and file) doesn’t exist, it can’t be mounted.
Create
$DOCKER_CONFIGS/conf/ssmtp/ssmtp.conf
file before starting the contianer.