0

I am building docker deployment scripts for my microservices right now. Following script gives me an error:

#!/bin/bash
DEPLOYMENT_PATH=$(pwd)
echo "NGINX deployment start"
docker run --name webserver -v $DEPLOYMENT_PATH/configuration/config.json:/usr/share/nginx/json/config.json \
                            -v $DEPLOYMENT_PATH/configuration/nginx.conf:/etc/nginx/nginx.conf \
                            -p 9999:80 \
                            --rm \
                            nginx:1.19.6
echo "Nginx deployed"

error msg:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "/home/polito/Projects/magister-media/fahrschule/compose/dev/deployment/nginx/configuration/config.json" to rootfs at "/var/lib/docker/overlay2/01e6399a1a95710406183f7a13b32b5c362795fc3b50c08316540a31afc080d4/merged/usr/share/nginx/json/config.json" caused: 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.
Nginx deployed

following the following article: Are you trying to mount a directory onto a file (or vice-versa)?

cat should return me "is a folder" but:

~/Projects/magister-media/fahrschule/compose/dev/deployment$ cat /home/polito/Projects/magister-media/fahrschule/compose/dev/deployment/nginx/configuration/config.json
{
"jeopardyURL": "http://jeopardy:8080",
"waterlooURL":"http://waterloo:8080",
"keycloakTokenURL": "http://keycloak:8080/auth/realms/drivingschool/protocol/openid-connect/token",
"keycloakClientId":"client_interface",
"keycloakClientSecret":"f06fe4b4-959f-4fb1-88e1-e7c4ad335743",
}

I have no clue why it's not working. Thanks in advance, Rosario

R. Polito
  • 544
  • 6
  • 21
  • 1
    /home/polito/Projects/magister-media/fahrschule/compose/dev/deployment/nginx/configuration/config.json is a file maybe you want to mount /home/polito/Projects/magister-media/fahrschule/compose/dev/deployment/nginx/configuration/config.json" to rootfs at "/var/lib/docker/overlay2/01e6399a1a95710406183f7a13b32b5c362795fc3b50c08316540a31afc080d4/merged/usr/share/nginx/json which would be a directory? – Raman Sailopal Feb 01 '21 at 08:47
  • But the error reads that i have to mount file to file, directory to directory, doesnt it? – R. Polito Feb 01 '21 at 09:22
  • docker run --name webserver -v $DEPLOYMENT_PATH/configuration/config.json:/usr/share/nginx/json/ \ -v $DEPLOYMENT_PATH/configuration/nginx.conf:/etc/nginx/nginx.conf \ this worked, no clue why its inconsistend in itself :( – R. Polito Feb 01 '21 at 10:32

0 Answers0