Unidata / thredds-docker

Dockerized THREDDS
https://hub.docker.com/r/unidata/thredds-docker
BSD 3-Clause "New" or "Revised" License
36 stars 28 forks source link

tomcat-users.xml: Are you trying to mount a directory onto a file (or vice-versa)? #245

Closed dpereiro91 closed 1 year ago

dpereiro91 commented 4 years ago

Hi,

I am new to Docker and I am getting the following error after I try to run the THREDDS Docker container. My host machine is an Ubuntu 18.04.4 LTS Bionic. I am working all the time as root user. My tomcat directory is /usr/local/tomcat/ My THREDDS directory is /data/content/thredds/

If I run:

      /usr/local/tomcat/bin/startup.sh 

and then enter:

      localhost:8080/thredds 

in my browser, I can access my THREDDS. To achieve this, I have followed the instructions in https://docs.unidata.ucar.edu/tds/5.0/userguide/install_java_tomcat.html

I can access my THREDDS, but only locally from my own device. Now, I would like to provide remote access to this THREDDS site to other people in my team. I have been unsuccessful to set up an Internet-accessible server, and I was planning to use thredds-docker to share it. So, this is my compose.env file:

THREDDS related environment variables

TDS Content root

TDS_CONTENT_ROOT_PATH=/data/content

The minimum and maximum Java heap space memory to be allocated to the TDS

THREDDS_XMX_SIZE=4G

THREDDS_XMS_SIZE=4G

TDM related environment variables

TDM_PW=CHANGEME!

TDS_HOST=http://thredds.yourhost.net/

The minimum and maximum Java heap space memory to be allocated to the TDM

TDM_XMX_SIZE=6G

TDM_XMS_SIZE=1G

See https://github.com/Unidata/tomcat-docker#configurable-tomcat-uid-and-gid

TOMCAT_USER_ID=1000

TOMCAT_GROUP_ID=1000

And this is my docker-compose.yml file:


version: '3.7'

services: thredds-quickstart: image: unidata/thredds-docker:4.6.15 ports:

Now, I run:

      docker-compose up -d thredds-production

I get the following error:

WARNING: The THREDDS_COMPOSE_ENV_LOCAL variable is not set. Defaulting to a blank string. Pulling thredds-production (unidata/thredds-docker:4.6.15)... 4.6.15: Pulling from unidata/thredds-docker 31dd5ebca5ef: Pull complete 3ed641c4ae98: Pull complete bcd57146431e: Pull complete ac34a4d7c330: Pull complete d29274a3f575: Pull complete 1b90ee88ecd5: Pull complete 4afcee973de8: Pull complete 2c12390d844d: Pull complete b897400f1d72: Pull complete 2c340c77d01a: Pull complete fdf399e5383d: Pull complete b023a96b2e65: Pull complete 5c28b600e776: Pull complete 989715f8647e: Pull complete ef56e7b9edc1: Pull complete a5cdc8ab3bdc: Pull complete 570a3fa3c344: Pull complete 32103930728e: Pull complete bf469156272c: Pull complete 2d415e5dfa04: Pull complete 7574c635e88a: Pull complete 8e75c1104650: Pull complete 0522597c673f: Pull complete 3906036ab2b9: Pull complete 46e958092e28: Pull complete 722b0418c608: Pull complete 1ca5b12fe7b8: Pull complete da22ad1ceb92: Pull complete c7a8d5bdd524: Pull complete 92d273a71f64: Pull complete 10ef33d3552b: Pull complete Digest: sha256:404c81e603623d312b31c9d0874614d94f17bc59db4aef4d68a51a5c11bb58bf Status: Downloaded newer image for unidata/thredds-docker:4.6.15 Creating thredds ... error

ERROR: for thredds Cannot start service thredds-production: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\"/path/to/your/tomcat-users.xml\\" to rootfs \\"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged\\" at \\"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged/usr/local/tomcat/conf/tomcat-users.xml\\" 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

ERROR: for thredds-production Cannot start service thredds-production: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\"/path/to/your/tomcat-users.xml\\" to rootfs \\"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged\\" at \\"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged/usr/local/tomcat/conf/tomcat-users.xml\\" 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 ERROR: Encountered errors while bringing up the project.

It is not clear to me how should I solve this problem. I have made sure that /usr/local/tomcat/conf/tomcat-users.xml exists as a file. Would you please provide me with any advice to solve this?

Thank you very much for your time, Diego

tc33133 commented 4 years ago

Looks like you're not setting up your volumes in your docker container properly. If the snippet of docker-compose.yml you attached is being used, you'll need to change /path/to in the following lines: volumes:

/path/to should be a real path on your system Good luck! Tom

On Sun, Aug 16, 2020 at 2:42 PM dpereiro91 notifications@github.com wrote:

Hi,

I am new to Docker and I am getting the following error after I try to run the THREDDS Docker container. My host machine is an Ubuntu 18.04.4 LTS Bionic. I am working all the time as root user. My tomcat directory is /usr/local/tomcat/ My THREDDS directory is /data/content/thredds/

If I run:

  /usr/local/tomcat/bin/startup.sh

and then enter:

  localhost:8080/thredds

in my browser, I can access my THREDDS. To achieve this, I have followed the instructions in https://docs.unidata.ucar.edu/tds/5.0/userguide/install_java_tomcat.html

I can access my THREDDS, but only locally from my own device. Now, I would like to provide remote access to this THREDDS site to other people in my team. I have been unsuccessful to set up an Internet-accessible server, and I was planning to use thredds-docker to share it. So, this is my compose.env file: THREDDS related environment variables TDS Content root

TDS_CONTENT_ROOT_PATH=/data/content The minimum and maximum Java heap space memory to be allocated to the TDS

THREDDS_XMX_SIZE=4G

THREDDS_XMS_SIZE=4G TDM related environment variables

TDM_PW=CHANGEME!

TDS_HOST=http://thredds.yourhost.net/ The minimum and maximum Java heap space memory to be allocated to the TDM

TDM_XMX_SIZE=6G

TDM_XMS_SIZE=1G See https://github.com/Unidata/tomcat-docker#configurable-tomcat-uid-and-gid

TOMCAT_USER_ID=1000

TOMCAT_GROUP_ID=1000

And this is my docker-compose.yml file:

version: '3.7'

services: thredds-quickstart: image: unidata/thredds-docker:4.6.15 ports:

  • "8000:8080"
  • "443:8443"
  • "8443:8443"

thredds-production: image: unidata/thredds-docker:4.6.15 ports:

  • "8000:8080"
  • "443:8443"
  • "8443:8443" container_name: thredds volumes:
  • /path/to/your/tomcat/logs/:/usr/local/tomcat/logs/
  • /path/to/your/thredds/logs/:/data/content/thredds/logs/
  • /path/to/your/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml
  • /path/to/your/thredds/directory:/data/content/thredds
  • /path/to/your/data/directory1:/data/content/thredds/public/testdata env_file:
  • "compose${THREDDS_COMPOSE_ENV_LOCAL}.env" TDM Not strictly part of this repo, but useful to have around https://github.com/Unidata/tdm-docker

tdm: image: unidata/tdm-docker:latest container_name: tdm volumes:

  • /path/to/your/thredds/directory:/usr/local/tomcat/content/thredds
  • /path/to/your/data/directory1:/path/to/your/data/directory1

    TDM logging non-configurable until 5.0 so you'll need tdm.sh and

    tdm.jar if you want to log outside the container :-(

  • /path/to/your/tdm/logs:/usr/local/tomcat/content/tdm/

Now, I run:

  docker-compose up -d thredds-production

I get the following error:

WARNING: The THREDDS_COMPOSE_ENV_LOCAL variable is not set. Defaulting to a blank string. Pulling thredds-production (unidata/thredds-docker:4.6.15)... 4.6.15: Pulling from unidata/thredds-docker 31dd5ebca5ef: Pull complete 3ed641c4ae98: Pull complete bcd57146431e: Pull complete ac34a4d7c330: Pull complete d29274a3f575: Pull complete 1b90ee88ecd5: Pull complete 4afcee973de8: Pull complete 2c12390d844d: Pull complete b897400f1d72: Pull complete 2c340c77d01a: Pull complete fdf399e5383d: Pull complete b023a96b2e65: Pull complete 5c28b600e776: Pull complete 989715f8647e: Pull complete ef56e7b9edc1: Pull complete a5cdc8ab3bdc: Pull complete 570a3fa3c344: Pull complete 32103930728e: Pull complete bf469156272c: Pull complete 2d415e5dfa04: Pull complete 7574c635e88a: Pull complete 8e75c1104650: Pull complete 0522597c673f: Pull complete 3906036ab2b9: Pull complete 46e958092e28: Pull complete 722b0418c608: Pull complete 1ca5b12fe7b8: Pull complete da22ad1ceb92: Pull complete c7a8d5bdd524: Pull complete 92d273a71f64: Pull complete 10ef33d3552b: Pull complete Digest: sha256:404c81e603623d312b31c9d0874614d94f17bc59db4aef4d68a51a5c11bb58bf Status: Downloaded newer image for unidata/thredds-docker:4.6.15 Creating thredds ... error

ERROR: for thredds Cannot start service thredds-production: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "rootfs_linux.go:58: mounting \"/path/to/your/tomcat-users.xml\" to rootfs \"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged\" at \"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged/usr/local/tomcat/conf/tomcat-users.xml\" 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

ERROR: for thredds-production Cannot start service thredds-production: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "rootfs_linux.go:58: mounting \"/path/to/your/tomcat-users.xml\" to rootfs \"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged\" at \"/var/lib/docker/overlay2/3facd32dde441ce4e4c0d58334e44316ead99616419d1b9cad14c10d4ddccc03/merged/usr/local/tomcat/conf/tomcat-users.xml\" 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 ERROR: Encountered errors while bringing up the project.

It is not clear to me how should I solve this problem. I have made sure that /usr/local/tomcat/conf/tomcat-users.xml exists as a file. Would you please provide me with any advice to solve this?

Thank you very much for your time, Diego

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Unidata/thredds-docker/issues/245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGINLK6PZIHAXRZR4RHGLOLSBBHEPANCNFSM4QBBDQYQ .

gerald-corzo commented 3 years ago

I am having the same trouble, but I am on a windows machine. Any help is very much appreciated.

  1. Enviromental variable in windows should be? I can change it but not sure what is the valure?

  2. The path to the volume and data should be replced where and how? d:/logs do not work for me, volumes:

    • d:/temp/logs/:/usr/local/tomcat/logs/
    • d:/temp/thredds/logs/:/usr/local/tomcat/content/thredds/logs/
    • d:/temp/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml
    • d:/temp/thredds/directory:/usr/local/tomcat/content/thredds
    • d:/temp/data/directory1:/temp/data/directory1
    • d:/temp/data/directory2:/temp/data/directory2 Here I am not sure the target in the containers I assume does not change, so why data in both sides?
  3. In the docker compose swatm.yml . volumes:

    • "d://temp//logs:/usr/local/tomcat/logs/"
    • "d://temp//logs:/usr/local/tomcat/content/thredds/logs/"
    • "d:/temp//usr:/usr/local/tomcat/conf/Catalina/localhost"
    • "d:/temp//thredds:/usr/local/tomcat/work/Catalina/localhost/thredds"

This is also not working I created all the folders and paths?

  1. last, but might had been my first question, should I only run docker-compose up -d thredds-production
    but I do not understand why the docker-swarm? which one is running or both, what stands swarm for or where can I read about this two modules and how the interact.

Sorry for my messy question but got stacked trying different things

julienchastang commented 3 years ago

Hi @gerald-corzo. It sounds like you are having trouble mounting host directories. Before trying to figure out THREDDS, I would ensure you can mount host directories. I am not familiar with Windows, but something like this should work:

docker run -v d:/some_directory:/data alpine ls /data

I also stumbled upon this that may help: https://token2shell.com/howto/docker/sharing-windows-folders-with-containers/